diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-11-13 05:05:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-11-22 14:29:30 +0000 |
commit | 5887a63a74e14a60f60eebc27a9e622598fe4cb3 (patch) | |
tree | 3f2ea5a71b8bc3828801d0d868e6d56e713eae50 /share/scripts | |
parent | Harmonizing manpage markup. (diff) | |
download | compute-tools-5887a63a74e14a60f60eebc27a9e622598fe4cb3.tar.xz compute-tools-5887a63a74e14a60f60eebc27a9e622598fe4cb3.zip |
Adding --clean option to curl container create script to remove downloaded tarball from cache after successfull container creation.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-x | share/scripts/curl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/share/scripts/curl b/share/scripts/curl index 6a9f784..8af1446 100755 --- a/share/scripts/curl +++ b/share/scripts/curl @@ -25,7 +25,7 @@ CACHE="/var/cache/container-tools/curl" Parameters () { - LONG_OPTIONS="bind:,script:,name:,image:,server:,password:" + LONG_OPTIONS="bind:,script:,name:,clean,image:,server:,password:" OPTIONS="b:,s:,n:,p:" PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${SCRIPT} --options ${OPTIONS} --shell sh -- ${@})" @@ -61,6 +61,11 @@ Parameters () shift 2 ;; + --clean) + CLEAN="true" + shift 1 + ;; + --image) IMAGE="${2}" shift 2 @@ -91,7 +96,7 @@ Parameters () Usage () { - echo "Usage: container create -n|--name NAME -s|--script ${SCRIPT} -- [--image IMAGE] [--server SERVER] [-p|--password PASSWORD}" >&2 + echo "Usage: container create -n|--name NAME -s|--script ${SCRIPT} -- [--clean] [--image IMAGE] [--server SERVER] [-p|--password PASSWORD}" >&2 exit 1 } @@ -190,3 +195,10 @@ cp -L /etc/resolv.conf "${MACHINES}/${NAME}/etc/resolv.conf" # Setting root password echo root:${PASSWORD} | chroot "${MACHINES}/${NAME}" chpasswd echo "${NAME}: root password set to '${PASSWORD}'." + +# Reove cache +case "${CLEAN}" in + true) + rm -f "${CACHE}/${IMAGE}" + ;; +esac |