diff options
Diffstat (limited to 'share/scripts/curl')
-rwxr-xr-x | share/scripts/curl | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/share/scripts/curl b/share/scripts/curl index 4a719f0..709e59c 100755 --- a/share/scripts/curl +++ b/share/scripts/curl @@ -27,8 +27,8 @@ CACHE="/var/cache/container-tools/system" Parameters () { - GETOPT_LONGOPTIONS="bind:,bind-ro:,script:,name:,clean,password:,server:,setup:,system:," - GETOPT_OPTIONS="b:,s:,n:,p:" + GETOPT_LONGOPTIONS="bind:,bind-ro:,script:,name:,architecture:,clean,password:,server:,setup:,system:," + GETOPT_OPTIONS="b:,s:,n:,a:,p:" PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${SCRIPT} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" @@ -73,6 +73,11 @@ Parameters () shift 2 ;; + -a|--architecture) + ARCHITECTURE="${2}" + shift 2 + ;; + --clean) CLEAN="true" shift 1 @@ -165,7 +170,6 @@ then exit 1 fi -ARCHITECTURE="${ARCHITECTURE:-$(dpkg --print-architecture)}" SERVER="${SERVER:-https://files.open-infrastructure.net/system/container/debian}" PASSWORD="${PASSWORD:-$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)}" @@ -239,9 +243,20 @@ then DEBCONF_TMPDIR="$(mktemp -d -p /tmp/container-tools -t $(basename ${0}).XXXX)" export DEBCONF_TMPDIR + if [ -z "${ARCHITECTURE}" ] + then + case "$(dpkg --print-architecture)" in + amd64) + GREP_PATTERN="(amd64|i386)" + ;; + esac + fi + + 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} \ - "${SERVER}/container-list.txt" -o "${DEBCONF_TMPDIR}/container-list.txt" + "${SERVER}/container-list.txt" | grep -E "${GREP_PATTERN}" > "${DEBCONF_TMPDIR}/container-list.txt" umask 0022 |