diff options
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-x | share/scripts/debconf | 92 |
1 files changed, 23 insertions, 69 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf index 5325c11..d710d17 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -1,7 +1,6 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers -# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net> +# Copyright (C) 2014-2019 Daniel Baumann <daniel.baumann@open-infrastructure.net> # # SPDX-License-Identifier: GPL-3.0+ # @@ -23,8 +22,8 @@ set -e SCRIPT="${0}" export SCRIPT -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/compute-tools/container/config" +HOOKS="/etc/compute-tools/container/hooks" MACHINES="/var/lib/machines" Parameters () @@ -157,7 +156,7 @@ Upgrade_system () # Disable dpkg syncing -cat > "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/container-tools" << EOF +cat > "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/compute-tools" << EOF force-unsafe-io EOF @@ -190,7 +189,7 @@ Cleanup_system () Chroot "${DIRECTORY}" "apt-get clean" # Cleanup - rm -f "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/container-tools" + rm -f "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/compute-tools" rm -f "${DIRECTORY}/usr/sbin/policy-rc.d" # Unmount pseudo-filesystems @@ -202,8 +201,8 @@ Cleanup_system () Debconf () { # Configure local debconf - mkdir -p /tmp/container-tools - DEBCONF_TMPDIR="$(mktemp -d -p /tmp/container-tools -t $(basename ${0}).XXXX)" + mkdir -p /tmp/compute-tools + DEBCONF_TMPDIR="$(mktemp -d -p /tmp/compute-tools -t $(basename ${0}).XXXX)" export DEBCONF_TMPDIR mkdir -p "${DEBCONF_TMPDIR}/debconf" @@ -247,12 +246,18 @@ Debootstrap () EXCLUDE="ifupdown" INCLUDE="dbus" - if echo "${MIRROR}" | grep -qs '^https' || \ - echo "{PARENT_MIRROR}" | grep -qs '^https' + if ( echo "${MIRROR}" | grep -qs '^https' ) || \ + ( echo "${PARENT_MIRROR}" | grep -qs '^https' ) then INCLUDE="${INCLUDE},apt-transport-https,ca-certificates" fi + case "${MODE}" in + progress-linux) + INCLUDE="${INCLUDE},progress-linux,gnupg" + ;; + esac + mkdir -p "$(dirname ${DIRECTORY})" debootstrap --verbose --arch=${ARCHITECTURE} --components=${PARENT_ARCHIVE_AREAS} \ --exclude=${EXCLUDE} --include=${INCLUDE} ${PARENT_DISTRIBUTION} "${DIRECTORY}" ${PARENT_MIRROR} @@ -332,58 +337,7 @@ EOF ;; esac - # Import archive keys - KEYS="project/pgp/archive-key-${DIST}.asc" - - for KEY in ${KEYS} - do - KEY_NAME="$(basename ${KEY})" - echo "P: Fetching archive-key ${KEY_NAME}..." - - wget -q "${MIRROR}/${KEY}" -O "${DIRECTORY}/key.asc" - wget -q "${MIRROR}/${KEY}.gpg" -O "${DIRECTORY}/key.asc.gpg" - - if [ -e /usr/bin/gpgv ] - then - if [ -e /usr/share/keyrings/debian-keyring.gpg ] || [ -e /usr/share/keyrings/debian-maintainers.gpg ] - then - KEY_VALID="" - - for KEYRING in /usr/share/keyrings/debian-keyring.gpg /usr/share/keyrings/debian-maintainers.gpg - do - if [ -e "${KEYRING}" ] - then - echo -n "I: Verifying archive-key ${KEY_NAME} against $(basename ${KEYRING} .gpg | sed -e 's|-keyring||') keyring..." - - # FIXME: doesn't work anymore when the template eventually be run with 'set -e' - /usr/bin/gpgv --quiet --keyring ${KEYRING} "${DIRECTORY}/key.asc.gpg" "${DIRECTORY}/key.asc" > /dev/null 2>&1 && KEY_VALID="true" && break - fi - done - - case "${KEY_VALID}" in - true) - echo " successful." - ;; - - *) - echo " failed." - return 1 - ;; - esac - else - echo "W: Skipping archive-key ${KEY_NAME} verification, debian-keyring not available..." - fi - else - echo "W: Skipping archive-key ${KEY_NAME} verification, gpgv not available..." - fi - - echo "P: Importing archive-key ${KEY_NAME}..." - - Chroot "${DIRECTORY}" "apt-key add key.asc" - rm -f "${DIRECTORY}/key.asc" - rm -f "${DIRECTORY}/key.asc.gpg" - done - + Chroot "${DIRECTORY}" "apt-key add /usr/share/progress-linux/pgp-keys/apt.progress-linux.org.gpg" || Chroot "${DIRECTORY}" "apt-key add /usr/share/progress-linux/pgp-keys/progress-linux-5-engywuck-archive-key.gpg" Chroot "${DIRECTORY}" "apt-get update" ;; esac @@ -898,7 +852,7 @@ EOF cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-up-eno${NUMBER}.service" << EOF [Unit] -Description=container-tools IPV4_POST_UP +Description=compute-tools IPV4_POST_UP After=network-online.target Wants=network-online.target @@ -918,7 +872,7 @@ EOF cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-down-eno${NUMBER}.service" << EOF [Unit] -Description=container-tools IPV4_POST_DOWN +Description=compute-tools IPV4_POST_DOWN After=network.target Wants=network.target @@ -1031,12 +985,12 @@ do done # Run debconf parts -for DEBCONF_SCRIPT in /usr/share/container-tools/scripts/debconf.d/* +for DEBCONF_SCRIPT in /usr/share/compute-tools/container/scripts/debconf.d/* do if [ -x "${DEBCONF_SCRIPT}" ] then # FIXME - # debconf -ocontainer-tools "${DEBCONF_SCRIPT}" + # debconf -ocompute-tools "${DEBCONF_SCRIPT}" "${DEBCONF_SCRIPT}" fi done @@ -1044,7 +998,7 @@ done # Read-in configuration from debconf . "${DEBCONF_TMPDIR}/debconf.default" -CACHE="/var/cache/container-tools/${MODE}" +CACHE="/var/cache/compute-tools/${MODE}" SYSTEM="${MACHINES}/${NAME}" ## Generic parts @@ -1057,7 +1011,7 @@ then mv "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}.tmp" "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" fi -Upgrade_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" || echo "W: If upgrading the system failed, try removing the cache for your distribution in /var/cache/container-tools" +Upgrade_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" || echo "W: If upgrading the system failed, try removing the cache for your distribution in /var/cache/compute-tools" Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ## Specific parts @@ -1175,7 +1129,7 @@ fi # remove debconf temporary files rm --preserve-root --one-file-system -rf "${DEBCONF_TMPDIR}" -rmdir --ignore-fail-on-non-empty /tmp/container-tools 2>&1 || true +rmdir --ignore-fail-on-non-empty /tmp/compute-tools 2>&1 || true # Post hooks for FILE in "${HOOKS}/post-${SCRIPT}".* "${HOOKS}/${NAME}.post-${SCRIPT}" |