diff options
Diffstat (limited to 'share/scripts')
-rwxr-xr-x | share/scripts/curl | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/share/scripts/curl b/share/scripts/curl index 8e1d0e7..4390dba 100755 --- a/share/scripts/curl +++ b/share/scripts/curl @@ -26,7 +26,7 @@ CACHE="/var/cache/container-tools/images" Parameters () { - GETOPT_LONGOPTIONS="bind:,bind-ro:,script:,name:,clean,image:,password:,server:," + GETOPT_LONGOPTIONS="bind:,bind-ro:,script:,name:,clean,password:,server:,system:," GETOPT_OPTIONS="b:,s:,n:,p:" PARAMETERS="$(getopt --longoptions ${GETOPT_LONGOPTIONS} --name=${SCRIPT} --options ${GETOPT_OPTIONS} --shell sh -- ${@})" @@ -77,11 +77,6 @@ Parameters () shift 1 ;; - --image) - IMAGE="${2}" - shift 2 - ;; - -p|--password) PASSWORD="${2}" shift 2 @@ -92,6 +87,11 @@ Parameters () shift 2 ;; + --system) + SYSTEM="${2}" + shift 2 + ;; + --) shift 1 break @@ -107,7 +107,7 @@ Parameters () Usage () { - echo "Usage: container create -n|--name NAME -s|--script ${SCRIPT} -- [--clean] [--image IMAGE] [-p|--password PASSWORD] [--server SERVER]" >&2 + echo "Usage: container create -n|--name NAME -s|--script ${SCRIPT} -- [--clean] [-p|--password PASSWORD] [--server SERVER] [--system SYSTEM]" >&2 exit 1 } @@ -151,8 +151,8 @@ else fi ARCHITECTURE="${ARCHITECTURE:-$(dpkg --print-architecture)}" -IMAGE="${IMAGE:-debian-stretch-${ARCHITECTURE}.system.tar.${COMPRESSION}}" -SETUP="$(echo ${IMAGE} | sed -e 's|.system.tar.|.setup.tar.|')" +SYSTEM="${SYSTEM:-debian-stretch-${ARCHITECTURE}.system.tar.${COMPRESSION}}" +SETUP="$(echo ${SYSTEM} | sed -e 's|.system.tar.|.setup.tar.|')" SERVER="${SERVER:-https://files.open-infrastructure.net/system/container/debian}" PASSWORD="${PASSWORD:-$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)}" @@ -183,7 +183,7 @@ then CURL_OPTIONS="${CURL_OPTIONS} --http2" fi -for FILE in "${IMAGE}" "${IMAGE}.sha512" \ +for FILE in "${SYSTEM}" "${SYSTEM}.sha512" \ "${SETUP}" "${SETUP}.sha512" do if curl --fail --head --output /dev/null --silent "${SERVER}/${FILE}" @@ -201,7 +201,7 @@ do fi done -for FILE in "${IMAGE}" "${SETUP}" +for FILE in "${SYSTEM}" "${SETUP}" do cd "${CACHE}" @@ -234,7 +234,7 @@ do cd "${OLDPWD}" done -case "${IMAGE}" in +case "${SYSTEM}" in *.gz) TAR_OPTIONS="--gzip" @@ -273,7 +273,7 @@ case "${IMAGE}" in ;; esac -for FILE in "${IMAGE}" "${SETUP}" +for FILE in "${SYSTEM}" "${SETUP}" do if [ ! -e "${CACHE}/${FILE}" ] then @@ -330,7 +330,7 @@ echo "${NAME}: root password set to '${PASSWORD}'." # Remove cache case "${CLEAN}" in true) - rm -f "${CACHE}/${IMAGE}" "${CACHE}/${IMAGE}.sha512" + rm -f "${CACHE}/${SYSTEM}" "${CACHE}/${SYSTEM}.sha512" rm -f "${CACHE}/${SETUP}" "${CACHE}/${SETUP}.sha512" ;; esac |