File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,20 @@ cleanup() {
1010 exit
1111}
1212
13+ untar () {
14+ local fname=" ${1?a file name is required} "
15+ shift
16+
17+ case " ${fname} " in
18+ * .zstd|* .zst)
19+ zstdcat " ${fname} " | tar -x -f - " $@ "
20+ ;;
21+ * )
22+ tar -x -f " ${fname} " " $@ "
23+ ;;
24+ esac
25+ }
26+
1327REMOTE_URL=" ${1?A remote URL is required} "
1428TARGET_DIR=" ${2?A target directory is required} "
1529
@@ -53,7 +67,7 @@ if [ -d "${CACHEDIR}" ]; then
5367
5468 # If the file is already cached, just extract it if possible
5569 if [ -r " ${CACHEDIR} /fetch/${FILENAME} " ]; then
56- if ! tar xf " ${CACHEDIR} /fetch/${FILENAME} " -C " ${TARGET_DIR} " ; then
70+ if ! untar " ${CACHEDIR} /fetch/${FILENAME} " -C " ${TARGET_DIR} " ; then
5771 echo " ERROR: extraction of cached file '${CACHEDIR} /fetch/${FILENAME} ' failed"
5872 else
5973 exit 0
@@ -75,7 +89,7 @@ if ! curl -L -s -o "${FETCH_DIR}/${FILENAME}" "${REMOTE_URL}"; then
7589 exit 1
7690fi
7791
78- if ! tar xf " ${FETCH_DIR} /${FILENAME} " -C " ${TARGET_DIR} " ; then
92+ if ! untar " ${FETCH_DIR} /${FILENAME} " -C " ${TARGET_DIR} " ; then
7993 echo " ERROR: extraction of fetched file '${REMOTE_URL} ' failed"
8094 exit 1
8195fi
Original file line number Diff line number Diff line change 4141trap cleanup EXIT INT TERM
4242
4343MIRROR=" https://mirrors.edge.kernel.org/archlinux/iso/latest"
44- PATTERN=" archlinux-bootstrap-[-_.A-Za-z0-9]\+-x86_64\.tar\.gz "
44+ PATTERN=" archlinux-bootstrap-[-_.A-Za-z0-9]\+-x86_64\.tar\.zst "
4545if ! ./helpers/extract_remote.sh " ${MIRROR} " " ${PACROOT} " " ${PATTERN} " ; then
4646 echo " ERROR: could not fetch and extract Arch bootstrap image"
4747 exit 1
You can’t perform that action at this time.
0 commit comments