Skip to content

Commit 558cff4

Browse files
committed
testing: accommodate zstd compression in Arch bootstrap archives
1 parent 9a6e7dc commit 558cff4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

testing/helpers/extract_remote.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
1327
REMOTE_URL="${1?A remote URL is required}"
1428
TARGET_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
7690
fi
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
8195
fi

testing/helpers/install-arch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fi
4141
trap cleanup EXIT INT TERM
4242

4343
MIRROR="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"
4545
if ! ./helpers/extract_remote.sh "${MIRROR}" "${PACROOT}" "${PATTERN}"; then
4646
echo "ERROR: could not fetch and extract Arch bootstrap image"
4747
exit 1

0 commit comments

Comments
 (0)