From 0f0239db45cbd40ff79f301bbade2f2dcb005931 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 17 Feb 2019 11:52:12 +0100 Subject: Renaming container-tools to compute-tools. Signed-off-by: Daniel Baumann --- share/scripts/debconf | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'share/scripts/debconf') diff --git a/share/scripts/debconf b/share/scripts/debconf index 2c26ffa..fbb20fa 100755 --- a/share/scripts/debconf +++ b/share/scripts/debconf @@ -1,6 +1,5 @@ #!/bin/sh -# container-tools - Manage systemd-nspawn containers # Copyright (C) 2014-2019 Daniel Baumann # # SPDX-License-Identifier: GPL-3.0+ @@ -20,11 +19,14 @@ set -e +PROJECT="open-infrastructure" +SOFTWARE="compute-tools" +PROGRAM="container" SCRIPT="${0}" export SCRIPT -CONFIG="/etc/container-tools/config" -HOOKS="/etc/container-tools/hooks" +CONFIG="/etc/${PROJECT}/${PROGRAM}/config" +HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks" MACHINES="/var/lib/machines" Parameters () @@ -157,7 +159,7 @@ Upgrade_system () # Disable dpkg syncing -cat > "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/container-tools" << EOF +cat > "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/${SOFTWARE}" << EOF force-unsafe-io EOF @@ -190,7 +192,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/${SOFTWARE}" rm -f "${DIRECTORY}/usr/sbin/policy-rc.d" # Unmount pseudo-filesystems @@ -202,8 +204,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/${SOFTWARE}" + DEBCONF_TMPDIR="$(mktemp -d -p "/tmp/${SOFTWARE}" -t $(basename ${0}).XXXX)" export DEBCONF_TMPDIR mkdir -p "${DEBCONF_TMPDIR}/debconf" @@ -853,7 +855,7 @@ EOF cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-up-eno${NUMBER}.service" << EOF [Unit] -Description=container-tools IPV4_POST_UP +Description=${SOFTWARE} IPV4_POST_UP After=network-online.target Wants=network-online.target @@ -873,7 +875,7 @@ EOF cat > "${DIRECTORY}/etc/systemd/system/cnt-ipv4-post-down-eno${NUMBER}.service" << EOF [Unit] -Description=container-tools IPV4_POST_DOWN +Description=${SOFTWARE} IPV4_POST_DOWN After=network.target Wants=network.target @@ -986,12 +988,12 @@ do done # Run debconf parts -for DEBCONF_SCRIPT in /usr/share/container-tools/scripts/debconf.d/* +for DEBCONF_SCRIPT in "/usr/share/${PROJECT}/${PROGRAM}/scripts/debconf.d"/* do if [ -x "${DEBCONF_SCRIPT}" ] then # FIXME - # debconf -ocontainer-tools "${DEBCONF_SCRIPT}" + # debconf -o${SOFTWARE} "${DEBCONF_SCRIPT}" "${DEBCONF_SCRIPT}" fi done @@ -999,7 +1001,7 @@ done # Read-in configuration from debconf . "${DEBCONF_TMPDIR}/debconf.default" -CACHE="/var/cache/container-tools/${MODE}" +CACHE="/var/cache/${PROJECT}/${PROGRAM}/${MODE}" SYSTEM="${MACHINES}/${NAME}" ## Generic parts @@ -1012,7 +1014,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/${PROJECT}/${PROGRAM}" Cleanup_system "${CACHE}/${DISTRIBUTION}_${ARCHITECTURE}" ## Specific parts @@ -1130,7 +1132,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/${SOFTWARE}" 2>&1 || true # Post hooks for FILE in "${HOOKS}/post-${SCRIPT}".* "${HOOKS}/${NAME}.post-${SCRIPT}" -- cgit v1.2.3