summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/man/container-create-curl.1.txt3
-rwxr-xr-xshare/scripts/curl23
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