diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2017-07-22 21:24:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2017-07-23 08:20:54 +0000 |
commit | 2f2460ff02f1b74963a81f968cf3105a8e852da0 (patch) | |
tree | fecb143fc93a133063acd311e633711375749793 /share | |
parent | Adding automatic compression detection for downloads in in curl container cre... (diff) | |
download | compute-tools-2f2460ff02f1b74963a81f968cf3105a8e852da0.tar.xz compute-tools-2f2460ff02f1b74963a81f968cf3105a8e852da0.zip |
Adding architecture option to curl container create script.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rw-r--r-- | share/man/container-create-curl.1.txt | 3 | ||||
-rwxr-xr-x | share/scripts/curl | 23 |
2 files changed, 22 insertions, 4 deletions
diff --git a/share/man/container-create-curl.1.txt b/share/man/container-create-curl.1.txt index 2c588cf..8e267ce 100644 --- a/share/man/container-create-curl.1.txt +++ b/share/man/container-create-curl.1.txt @@ -51,6 +51,9 @@ The following script options are available: *-n, --name='NAME'*:: Specify container name. +*-a, --architecture='ARCHITECTURE'*:: + Specify container architecture. + "--clean*:: Remove downloaded tarball after successfull container creation. 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 |