diff options
Diffstat (limited to 'share/scripts/curl')
-rwxr-xr-x | share/scripts/curl | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/share/scripts/curl b/share/scripts/curl index 965bc26..54def52 100755 --- a/share/scripts/curl +++ b/share/scripts/curl @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ @@ -20,12 +19,15 @@ set -e +PROJECT="open-infrastructure" +SOFTWARE="compute-tools" +PROGRAM="container" SCRIPT="${0}" -HOOKS="/etc/container-tools/hooks" -KEYS="/etc/container-tools/keys" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" +KEYS="/etc/${PROJECT}/${PROGRAM}/keys" MACHINES="/var/lib/machines" -CACHE="/var/cache/container-tools/system" +CACHE="/var/cache/${PROJECT}/${PROGRAM}/system" Parameters () { @@ -241,8 +243,8 @@ then # Downloading container list if curl --fail --head --output /dev/null --silent "${SERVER}/container-list.txt" then - mkdir -p /tmp/container-tools - DEBCONF_TMPDIR="$(mktemp -d -p /tmp/container-tools -t $(basename ${0}).XXXX)" + mkdir -p "/tmp/${SOFTWARE}" + DEBCONF_TMPDIR="$(mktemp -d -p "/tmp/${SOFTWARE}" -t $(basename ${0}).XXXX)" export DEBCONF_TMPDIR if [ -z "${ARCHITECTURE}" ] @@ -257,7 +259,7 @@ then GREP_PATTERN="${GREP_PATTERN:-${ARCHITECTURE}}" echo "Downloading $(echo ${SERVER} | awk -F/ '{ print $3 }') container list" - curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \ + curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} ${CURL_OPTIONS} \ "${SERVER}/container-list.txt" | grep -E "${GREP_PATTERN}" > "${DEBCONF_TMPDIR}/container-list.txt" umask 0022 @@ -265,12 +267,12 @@ then Debconf # Run debconf parts - for DEBCONF_SCRIPT in /usr/share/container-tools/scripts/curl.d/* + for DEBCONF_SCRIPT in /usr/share/${PROJECT}/${PROGRAM}/scripts/curl.d/* do if [ -x "${DEBCONF_SCRIPT}" ] then # FIXME - # debconf -ocontainer-tools "${DEBCONF_SCRIPT}" + # debconf -o${SOFTWARE} "${DEBCONF_SCRIPT}" "${DEBCONF_SCRIPT}" fi done @@ -280,7 +282,7 @@ then # 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 + rmdir --ignore-fail-on-non-empty "/tmp/${SOFTWARE}" 2>&1 || true fi fi @@ -320,7 +322,7 @@ do fi echo "Downloading ${FILE}" - curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} ${CURL_TIME_COND} \ + curl --fail --location --progress-bar --user-agent ${SOFTWARE}/${VERSION} ${CURL_OPTIONS} ${CURL_TIME_COND} \ "${SERVER}/${FILE}" -o "${CACHE}/${FILE}" fi done |