summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xshare/scripts/curl32
1 files changed, 24 insertions, 8 deletions
diff --git a/share/scripts/curl b/share/scripts/curl
index 62ce9be..4a719f0 100755
--- a/share/scripts/curl
+++ b/share/scripts/curl
@@ -142,16 +142,25 @@ then
exit 1
fi
+COMPRESSIONS=""
+
if [ -x /usr/bin/lzip ]
then
- COMPRESSION="lz"
-elif [ -x /usr/bin/xz ]
+ COMPRESSIONS="${COMPRESSIONS} lz"
+fi
+
+if [ -x /usr/bin/xz ]
+then
+ COMPRESSIONS="${COMPRESSIONS} xz"
+fi
+
+if [ -x /bin/gzip ]
then
- COMPRESSION="xz"
-elif [ -x /bin/gzip ]
+ COMPRESSIONS="${COMPRESSIONS} gz"
+fi
+
+if [ -z "${COMPRESSIONS}" ]
then
- COMPRESSION="gz"
-else
echo "'${NAME}': no supported compressor available (lz, xz, gz)."
exit 1
fi
@@ -252,14 +261,21 @@ then
# Read-in configuration from debconf
. "${DEBCONF_TMPDIR}/debconf.default"
- SYSTEM="${SYSTEM}.${COMPRESSION}"
-
# Remove debconf temporary files
rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}"
rmdir --ignore-fail-on-non-empty /tmp/container-tools 2>&1 || true
fi
fi
+for COMPRESSION in ${COMPRESSIONS}
+do
+ if curl --fail --head --output /dev/null --silent "${SERVER}/${SYSTEM}.${COMPRESSION}"
+ then
+ SYSTEM="${SYSTEM}.${COMPRESSION}"
+ break
+ fi
+done
+
# Downloading container files
mkdir -p "${CACHE}"