From 2f2460ff02f1b74963a81f968cf3105a8e852da0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 22 Jul 2017 23:24:08 +0200 Subject: Adding architecture option to curl container create script. Signed-off-by: Daniel Baumann --- share/scripts/curl | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'share/scripts') 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 -- cgit v1.2.3