diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2017-07-22 20:16:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2017-07-23 08:20:54 +0000 |
commit | c1212ba4918e64ea358ad5df24d2c53c99f9368e (patch) | |
tree | eb6be0b7ebfc8fda052e0160c3b10fea209c44ce /share/scripts/curl | |
parent | Adding interactive container list in curl container create script. (diff) | |
download | compute-tools-c1212ba4918e64ea358ad5df24d2c53c99f9368e.tar.xz compute-tools-c1212ba4918e64ea358ad5df24d2c53c99f9368e.zip |
Adding automatic compression detection for downloads in in curl container create directory.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/scripts/curl')
-rwxr-xr-x | share/scripts/curl | 32 |
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}" |