summaryrefslogtreecommitdiffstats
path: root/share/scripts/curl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-07-22 21:24:08 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-07-23 08:20:54 +0000
commit2f2460ff02f1b74963a81f968cf3105a8e852da0 (patch)
treefecb143fc93a133063acd311e633711375749793 /share/scripts/curl
parentAdding automatic compression detection for downloads in in curl container cre... (diff)
downloadcompute-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 'share/scripts/curl')
-rwxr-xr-xshare/scripts/curl23
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