diff options
Diffstat (limited to 'share/doc/examples')
-rwxr-xr-x | share/doc/examples/container-images.sh | 55 | ||||
-rw-r--r-- | share/doc/examples/dschinn-backports.cfg | 41 | ||||
-rw-r--r-- | share/doc/examples/stretch.cfg | 7 |
3 files changed, 71 insertions, 32 deletions
diff --git a/share/doc/examples/container-images.sh b/share/doc/examples/container-images.sh index b743f57..07f3451 100755 --- a/share/doc/examples/container-images.sh +++ b/share/doc/examples/container-images.sh @@ -3,7 +3,7 @@ # container-tools - Manage systemd-nspawn containers # # Description: example for automated Debian base system container image creation -# Requires: debootstrap xz-utils +# Requires: debootstrap plzip xz-utils # Usage: sudo ./container-images.sh set -e @@ -13,25 +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}" + + echo "Creating ${SYSTEM}.system.tar.${COMPRESSION}.sha512" + sha512sum "${SYSTEM}.system.tar.${COMPRESSION}" > "${SYSTEM}.system.tar.${COMPRESSION}.sha512" - debootstrap --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${SOURCE} ${MIRROR} - chroot "${SOURCE}" apt-get clean + echo "Creating ${SYSTEM}.system.tar.${COMPRESSION} symlink" + ln -sf "${SYSTEM}.system.tar.${COMPRESSION}" "$(echo ${SYSTEM}.system.tar.${COMPRESSION} | sed -e "s|${VERSION}|current|")" - 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}.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 cfJ "${TARGET}.tar.xz" "${SOURCE}" + rm -rf "${SYSTEM}" done done diff --git a/share/doc/examples/dschinn-backports.cfg b/share/doc/examples/dschinn-backports.cfg index 1cddcf2..4f72268 100644 --- a/share/doc/examples/dschinn-backports.cfg +++ b/share/doc/examples/dschinn-backports.cfg @@ -3,6 +3,11 @@ # example for automated Progress Linux 4+ (dschinn-backports) container creation # using: sudo container create -s progress-linux +debconf debconf/priority select critical +debconf debconf/frontend select Noninteractive + +container-tools cnt-debconf/mode select progress-linux + #container-tools cnt-debconf/preseed-files string #container-tools cnt-debconf/include-preseed-files string @@ -23,21 +28,21 @@ container-tools cnt-debconf/parent-mirror-security string http://security.debian container-tools cnt-debconf/archive-areas multiselect main, contrib, non-free container-tools cnt-debconf/parent-archive-areas multiselect main, contrib, non-free -container-tools cnt-debconf/packages string openssh-server +container-tools cnt-debconf/packages string knot-resolver openssh-server container-tools cnt-debconf/root-password string progress #container-tools cnt-debconf/root-password-crypted string # Network IP configuration -container-tools cnt-debconf/network0/bridge string br0 -container-tools cnt-debconf/network0/veth string veth0 -container-tools cnt-debconf/network0/ipv4-method select static -container-tools cnt-debconf/network0/ipv4-comment string Primary network interfaces -container-tools cnt-debconf/network0/ipv4-address string 192.168.0.2 -container-tools cnt-debconf/network0/ipv4-gateway string 192.168.0.1 -container-tools cnt-debconf/network0/ipv4-netmask string 255.255.255.0 -#container-tools cnt-debconf/network0/ipv4-post-up string -#container-tools cnt-debconf/network0/ipv4-post-down string +container-tools cnt-debconf/network1/bridge string bridge0 +container-tools cnt-debconf/network1/veth string veth0 +container-tools cnt-debconf/network1/ipv4-method select static +container-tools cnt-debconf/network1/ipv4-comment string Primary network interfaces +container-tools cnt-debconf/network1/ipv4-address string 192.168.0.2 +container-tools cnt-debconf/network1/ipv4-gateway string 192.168.0.1 +container-tools cnt-debconf/network1/ipv4-netmask string 255.255.255.0 +#container-tools cnt-debconf/network1/ipv4-post-up string +#container-tools cnt-debconf/network1/ipv4-post-down string # Network DNS configuration container-tools cnt-debconf/nameserver/server string 127.0.0.1 8.8.8.8 8.8.4.4 @@ -46,14 +51,14 @@ container-tools cnt-debconf/nameserver/search string example.net container-tools cnt-debconf/nameserver/options string timeout:1 attempts:1 # Third-Party Repositories -#container-tools cnt-debconf/archive0/repository string -#container-tools cnt-debconf/archive0/list string -#container-tools cnt-debconf/archive0/comment string -#container-tools cnt-debconf/archive0/source string -#container-tools cnt-debconf/archive0/key string -#container-tools cnt-debconf/archive0/preferences-package string -#container-tools cnt-debconf/archive0/preferences-pin string -#container-tools cnt-debconf/archive0/preferences-pin-priority +#container-tools cnt-debconf/archive1/repository string +#container-tools cnt-debconf/archive1/list string +#container-tools cnt-debconf/archive1/comment string +#container-tools cnt-debconf/archive1/source string +#container-tools cnt-debconf/archive1/key string +#container-tools cnt-debconf/archive1/preferences-package string +#container-tools cnt-debconf/archive1/preferences-pin string +#container-tools cnt-debconf/archive1/preferences-pin-priority # Internal Options #container-tools cnt-debconf/apt-recommends string diff --git a/share/doc/examples/stretch.cfg b/share/doc/examples/stretch.cfg index 2af4b85..4a137b7 100644 --- a/share/doc/examples/stretch.cfg +++ b/share/doc/examples/stretch.cfg @@ -3,6 +3,11 @@ # example for automated Debian 9 (stretch) based container creation # using: sudo container create -s debian +debconf debconf/priority select critical +debconf debconf/frontend select Noninteractive + +container-tools cnt-debconf/mode select debian + #container-tools cnt-debconf/preseed-files string #container-tools cnt-debconf/include-preseed-files string @@ -28,5 +33,5 @@ container-tools cnt-debconf/packages string openssh-server container-tools cnt-debconf/root-password string debian #container-tools cnt-debconf/root-password-crypted string -container-tools cnt-debconf/network0/bridge string br0 +container-tools cnt-debconf/network1/bridge string bridge0 #container-tools cnt-debconf/network-mac string |