summaryrefslogtreecommitdiffstats
path: root/share/scripts/debconf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-23 15:36:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-23 16:30:59 +0000
commit93d59c3176876b0990b27375458cf6518459bb07 (patch)
tree85403b3d9ac7f9df4b91195124b342dee81ec640 /share/scripts/debconf
parentReleasing debian version 20180825-3. (diff)
downloadopen-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.tar.xz
open-infrastructure-compute-tools-93d59c3176876b0990b27375458cf6518459bb07.zip
Merging upstream version 20190222.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-xshare/scripts/debconf95
1 files changed, 26 insertions, 69 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 5325c11..fbb20fa 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+
#
@@ -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"
@@ -247,12 +249,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 +340,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-get update"
;;
esac
@@ -898,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
@@ -918,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
@@ -1031,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
@@ -1044,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
@@ -1057,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
@@ -1175,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}"