summaryrefslogtreecommitdiffstats
path: root/share/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-11-22 15:09:51 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-11-22 15:09:51 +0000
commitf0966c697855767e3cd7d92f96f0801099e14f38 (patch)
treee6469fee633b4bd92946c99d5f1f587913d95354 /share/scripts
parentReleasing debian version 20161112-1. (diff)
downloadopen-infrastructure-compute-tools-f0966c697855767e3cd7d92f96f0801099e14f38.tar.xz
open-infrastructure-compute-tools-f0966c697855767e3cd7d92f96f0801099e14f38.zip
Merging upstream version 20161122.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'share/scripts')
-rwxr-xr-xshare/scripts/curl50
-rwxr-xr-xshare/scripts/debconf4
2 files changed, 48 insertions, 6 deletions
diff --git a/share/scripts/curl b/share/scripts/curl
index 0cf38e9..b67cbd4 100755
--- a/share/scripts/curl
+++ b/share/scripts/curl
@@ -21,11 +21,11 @@ set -e
SCRIPT="${0}"
MACHINES="/var/lib/machines"
-CACHE="/var/cache/container-tools/curl"
+CACHE="/var/cache/container-tools/images"
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
}
@@ -142,9 +147,38 @@ then
CURL_OPTIONS="--time-cond ${CACHE}/${IMAGE}"
fi
-curl --http2 --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \
+if curl -V | grep -qs http2
+then
+ CURL_OPTIONS="${CURL_OPTIONS} --http2"
+fi
+
+curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \
"${SERVER}/${IMAGE}" -o "${CACHE}/${IMAGE}"
+curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \
+ "${SERVER}/${IMAGE}.sha512" -o "${CACHE}/${IMAGE}.sha512"
+
+echo -n "Verifying ${IMAGE}.sha512"
+cd "${CACHE}"
+set +e
+
+sha512sum --check "${IMAGE}.sha512" --status
+SHA512SUM="${?}"
+
+case "${SHA512SUM}" in
+ 0)
+ echo " ok."
+ ;;
+
+ *)
+ echo " failed."
+ exit 1
+ ;;
+esac
+
+set -e
+cd "${OLDPWD}"
+
echo "Unpacking ${IMAGE}"
mkdir -p "${MACHINES}/${NAME}"
@@ -185,3 +219,11 @@ 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}"
+ rm -f "${CACHE}/${IMAGE}.sha512"
+ ;;
+esac
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 75cbfb0..1cb49b0 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -247,11 +247,11 @@ Debootstrap ()
# FIXME: trim down, debootstrap variants?
case "${MODE}" in
debian)
- INCLUDE="${INCLUDE},locales,libui-dialog-perl,dialog,isc-dhcp-client,netbase,net-tools,iproute,wget"
+ INCLUDE="${INCLUDE},locales,dialog,isc-dhcp-client,netbase,net-tools,iproute,wget"
;;
progress-linux)
- INCLUDE="${INCLUDE},apt-utils,locales-all,libui-dialog-perl,dialog,isc-dhcp-client,netbase,net-tools,iproute,openssh-server,wget"
+ INCLUDE="${INCLUDE},apt-utils,locales-all,dialog,isc-dhcp-client,netbase,net-tools,iproute,openssh-server,wget"
;;
esac