summaryrefslogtreecommitdiffstats
path: root/share/doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-07-22 14:31:16 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-07-23 08:20:40 +0000
commit120b2a166829474c3290d130ee0851880a248ad8 (patch)
tree637998a64293e6cd7b8aeb9cc5dd3d13c221ecbd /share/doc
parentUpdating container-create-curl manpage to match current curl container create... (diff)
downloadcompute-tools-120b2a166829474c3290d130ee0851880a248ad8.tar.xz
compute-tools-120b2a166829474c3290d130ee0851880a248ad8.zip
Updating container-images.sh example script to match current curl container create script expectations.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/doc')
-rwxr-xr-xshare/doc/examples/container-images.sh54
1 files changed, 40 insertions, 14 deletions
diff --git a/share/doc/examples/container-images.sh b/share/doc/examples/container-images.sh
index a995be5..07f3451 100755
--- a/share/doc/examples/container-images.sh
+++ b/share/doc/examples/container-images.sh
@@ -13,28 +13,54 @@ DISTRIBUTIONS="stretch sid"
MIRROR="https://deb.debian.org/debian"
INCLUDE="dbus"
-DATE="$(date +%Y%m%d)"
+COMPRESSIONS="gz lz xz"
+
+VERSION="$(date +%Y%m%d)"
for DISTRIBUTION in ${DISTRIBUTIONS}
do
for ARCHITECTURE in ${ARCHITECTURES}
do
- SOURCE="debian-${DISTRIBUTION}-${ARCHITECTURE}_${DATE}"
- TARGET="debian-${DISTRIBUTION}-${ARCHITECTURE}"
+ SYSTEM="debian-${DISTRIBUTION}-${VERSION}_${ARCHITECTURE}"
+
+ debootstrap --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${SYSTEM} ${MIRROR}
+ chroot "${SYSTEM}" apt-get clean
+
+ rm -f "${SYSTEM}/etc/apt/apt.conf.d/01autoremove-kernels"
+ rm -f "${SYSTEM}/etc/hostname"
+ echo "" > "${SYSTEM}/etc/machine-id"
+ rm -f "${SYSTEM}/etc/resolv.conf"
+ rm -f "${SYSTEM}/var/lib/systemd/catalog/database"
+
+ for COMPRESSION in ${COMPRESSIONS}
+ do
+ case "${COMPRESSION}" in
+ gz)
+ TAR_OPTIONS="--gzip"
+ ;;
+
+ lz)
+ TAR_OPTIONS="--lzip"
+ ;;
+
+ xz)
+ TAR_OPTIONS="--xz"
+ ;;
+ esac
+
+ echo "Creating ${SYSTEM}.system.tar.${COMPRESSION}"
+ tar ${TAR_OPTIONS} -cf "${SYSTEM}.system.tar.${COMPRESSION}" "${SYSTEM}"
- debootstrap --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${SOURCE} ${MIRROR}
- chroot "${SOURCE}" apt-get clean
+ echo "Creating ${SYSTEM}.system.tar.${COMPRESSION}.sha512"
+ sha512sum "${SYSTEM}.system.tar.${COMPRESSION}" > "${SYSTEM}.system.tar.${COMPRESSION}.sha512"
- rm -f "${SOURCE}/etc/apt/apt.conf.d/01autoremove-kernels"
- rm -f "${SOURCE}/etc/hostname"
- echo "" > "${SOURCE}/etc/machine-id"
- rm -f "${SOURCE}/etc/resolv.conf"
- rm -f "${SOURCE}/var/lib/systemd/catalog/database"
+ echo "Creating ${SYSTEM}.system.tar.${COMPRESSION} symlink"
+ ln -sf "${SYSTEM}.system.tar.${COMPRESSION}" "$(echo ${SYSTEM}.system.tar.${COMPRESSION} | sed -e "s|${VERSION}|current|")"
- echo "Creating ${TARGET}.tar.lz"
- tar --lzip -cf "${TARGET}.tar.lz" "${SOURCE}"
+ echo "Creating ${SYSTEM}.system.tar.${COMPRESSION}.sha512 copy"
+ sed -e "s|${VERSION}|current|" "${SYSTEM}.system.tar.${COMPRESSION}.sha512" > "$(echo ${SYSTEM}.system.tar.${COMPRESSION}.sha512 | sed -e "s|${VERSION}|current|")"
+ done
- echo "Creating ${TARGET}.tar.xz"
- tar --xz -cf "${TARGET}.tar.xz" "${SOURCE}"
+ rm -rf "${SYSTEM}"
done
done