summaryrefslogtreecommitdiffstats
path: root/share/doc/examples
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-11-12 07:51:17 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-12-11 12:27:10 +0000
commitd06d7b1b2e7ea48c42497ea6381a7d58ed4121e0 (patch)
treef41ae8266df0ed99de0941d748d523d6f289c4bc /share/doc/examples
parentAdding upstream version 20161105. (diff)
downloadopen-infrastructure-compute-tools-d06d7b1b2e7ea48c42497ea6381a7d58ed4121e0.tar.xz
open-infrastructure-compute-tools-d06d7b1b2e7ea48c42497ea6381a7d58ed4121e0.zip
Adding upstream version 20161112.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'share/doc/examples')
-rwxr-xr-xshare/doc/examples/container-images.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/share/doc/examples/container-images.sh b/share/doc/examples/container-images.sh
new file mode 100755
index 0000000..74e7ee0
--- /dev/null
+++ b/share/doc/examples/container-images.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# container-tools - Manage systemd-nspawn containers
+#
+# Description: example for automated Debian base system container image creation
+# Requires: debootstrap xz-utils
+# Usage: sudo ./container-images.sh
+
+set -e
+
+ARCHITECTURES="amd64 i386"
+DISTRIBUTIONS="stretch sid"
+MIRROR="http://deb.debian.org/debian"
+INCLUDE="dbus"
+
+DATE="$(date +%Y%m%d)"
+
+for DISTRIBUTION in ${DISTRIBUTIONS}
+do
+ for ARCHITECTURE in ${ARCHITECTURES}
+ do
+ SOURCE="debian-${DISTRIBUTION}-${ARCHITECTURE}_${DATE}"
+ TARGET="debian-${DISTRIBUTION}-${ARCHITECTURE}"
+
+ debootstrap --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${SOURCE} ${MIRROR}
+ chroot "${SOURCE}" apt-get clean
+
+ 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 ${TARGET}.tar.xz"
+ tar cfJ "${TARGET}.tar.xz" "${SOURCE}"
+ done
+done