@@ -21,25 +21,21 @@ if [ -n "${QEMU:-}" ]; then
2121
2222 if [ -z " ${QEMU#* .gz} " ]; then
2323 # image is .gz : download and uncompress it
24- qemufile=" $( echo " ${QEMU% .gz} " | sed ' s/\//__/g' ) "
25- if [ ! -f " ${tmpdir} /${qemufile} " ]; then
26- curl --retry 5 " ${mirrors_url} /${QEMU} " |
27- gunzip -d > " ${tmpdir} /${qemufile} "
28- fi
24+ base_file=" ${QEMU% .gz} "
25+ pipe_cmd=" gunzip -d"
2926 elif [ -z " ${QEMU#* .xz} " ]; then
3027 # image is .xz : download and uncompress it
31- qemufile=" $( echo " ${QEMU% .xz} " | sed ' s/\//__/g' ) "
32- if [ ! -f " ${tmpdir} /${qemufile} " ]; then
33- curl --retry 5 " ${mirrors_url} /${QEMU} " |
34- unxz > " ${tmpdir} /${qemufile} "
35- fi
28+ base_file=" ${QEMU% .xz} "
29+ pipe_cmd=" unxz"
3630 else
3731 # plain qcow2 image: just download it
38- qemufile=" $( echo " ${QEMU} " | sed ' s/\//__/g' ) "
39- if [ ! -f " ${tmpdir} /${qemufile} " ]; then
40- curl --retry 5 " ${mirrors_url} /${QEMU} " \
41- > " ${tmpdir} /${qemufile} "
42- fi
32+ base_file=" $QEMU "
33+ pipe_cmd=" cat" # nop to forward the result
34+ fi
35+
36+ qemufile=" $( echo " $base_file " | sed ' s/\//__/g' ) "
37+ if [ ! -f " ${tmpdir} /${qemufile} " ]; then
38+ curl --retry 5 " ${mirrors_url} /${QEMU} " | $pipe_cmd > " ${tmpdir} /${qemufile} "
4339 fi
4440
4541 # Create a mount a fresh new filesystem image that we'll later pass to QEMU.
0 commit comments