summaryrefslogtreecommitdiffstats
path: root/share/doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-11-12 01:01:13 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-11-12 07:47:21 +0000
commit5ead5e97366d4a6d1b1dae9efcbf6ed3e49bd43c (patch)
treea23a94fabbb0b82e9b3520990fe1683dc73595f2 /share/doc
parentCorrecting syntax in usage message of container create scripts. (diff)
downloadcompute-tools-5ead5e97366d4a6d1b1dae9efcbf6ed3e49bd43c.tar.xz
compute-tools-5ead5e97366d4a6d1b1dae9efcbf6ed3e49bd43c.zip
Adding initial curl container create script.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-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