summaryrefslogtreecommitdiffstats
path: root/share/build-scripts/debconf.d
diff options
context:
space:
mode:
Diffstat (limited to 'share/build-scripts/debconf.d')
-rwxr-xr-xshare/build-scripts/debconf.d/0001-preseed-file131
-rw-r--r--share/build-scripts/debconf.d/0001-preseed-file.templates18
-rwxr-xr-xshare/build-scripts/debconf.d/0002-preseed-debconf111
-rwxr-xr-xshare/build-scripts/debconf.d/0003-debconf1371
-rw-r--r--share/build-scripts/debconf.d/0003-debconf.templates276
5 files changed, 1907 insertions, 0 deletions
diff --git a/share/build-scripts/debconf.d/0001-preseed-file b/share/build-scripts/debconf.d/0001-preseed-file
new file mode 100755
index 0000000..aa2c3c7
--- /dev/null
+++ b/share/build-scripts/debconf.d/0001-preseed-file
@@ -0,0 +1,131 @@
+#!/bin/sh
+
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+set -e
+
+PROJECT="open-infrastructure"
+SOFTWARE="compute-tools"
+PROGRAM="container"
+
+CONFIG="/etc/${SOFTWARE}/config"
+DEBCONF="/etc/${SOFTWARE}/debconf"
+
+DEBCONF_NOWARNINGS="true"
+export DEBCONF_NOWARNINGS
+
+. /usr/share/debconf/confmodule
+
+# debconf template hierarchy (first match wins):
+#
+# 1. user specified a preseed file through commandline options
+# 2. /etc/compute-tools/debconf/${NAME}.cfg exists
+# 3. /etc/compute-tools/debconf/links/${NAME}.cfg exists
+# 4. /etc/compute-tools/debconf/*/${NAME}.cfg exists (only one file!)
+# 5. /etc/compute-tools/debconf/default.cfg exists
+# 6. user chooses from list of available (if any) *.cfg files
+# (recursively) found in /etc/compute-tools/debconf,
+# /etc/compute-tools/debconf/links is excluded.
+
+if [ -n "${PRESEED_FILE}" ]
+then
+ # user specified one or more preseed files through commandline option
+ db_set container/preseed-file "${PRESEED_FILE}"
+ db_fset container/preseed-file seen true
+elif [ -e "${DEBCONF}/${NAME}.cfg" ]
+then
+ # user did not specify a pressed file, but there is a matching one
+ # available on the system matching the container name
+ db_set container/preseed-file "${DEBCONF}/${NAME}.cfg"
+ db_fset container/preseed-file seen true
+elif [ -e "${DEBCONF}/links/${NAME}.cfg" ]
+then
+ # user did not specify a pressed file, but there is a matching one
+ # in /etc/${SOFTWARE}/debconf/links directory
+ db_set container/preseed-file "${DEBCONF}/links/${NAME}.cfg"
+ db_fset container/preseed-file seen true
+elif [ "$(ls ${DEBCONF}/*/${NAME}.cfg 2>/dev/null | wc -l)" -eq 1 ]
+then
+ # user did not specify a pressed file, but there is 1 (and only 1)
+ # matching in a sub-directory of /etc/${SOFTWARE}/debconf
+
+ FILE="$(ls ${DEBCONF}/*/${NAME}.cfg)"
+
+ db_set container/preseed-file "${FILE}"
+ db_fset container/preseed-file seen true
+elif [ -e "${DEBCONF}/default.cfg" ]
+then
+ # user did not specify a pressed file, but there is a default one
+ db_set container/preseed-file "${DEBCONF}/default.cfg"
+ db_fset container/preseed-file seen true
+elif ls "${DEBCONF}"/*.cfg > /dev/null 2>&1 || ls "${DEBCONF}"/*/*.cfg > /dev/null 2>&1
+then
+ # user has not specified preseed files through commandline option,
+ # showing debconf selection dialog for global preseed file.
+
+ FILES="$(cd ${DEBCONF} && find . -type f -name '*.cfg' -printf '%P\n' | grep -v '^links\/' | LC_ALL=C sort -V)"
+ PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "$(echo ${FILE} | sed -e 's|.cfg$||'), "; done | sed -e 's|, $||')"
+
+ if [ -n "${PRESEED_FILES}" ]
+ then
+ db_subst container/preseed-files CHOICES "custom, exit, none, , ${PRESEED_FILES}"
+
+ db_settitle container/title
+ db_input high container/preseed-files || true
+ db_go
+
+ db_get container/preseed-files
+ PRESEED_FILE="${RET}" # select
+
+ case "${PRESEED_FILE}" in
+ custom|none)
+ ;;
+
+ exit)
+ rm -f "${CONFIG}/${NAME}.conf"
+ exit 1
+ ;;
+
+ *)
+ # user specified preseed file through debconf select
+ db_set container/preseed-file "${DEBCONF}/${PRESEED_FILE}.cfg"
+ db_fset container/preseed-file seen true
+ ;;
+ esac
+ fi
+fi
+
+case "${PRESEED_FILE}" in
+ none)
+ ;;
+
+ *)
+ # ask user for a preseed file
+ db_settitle container/title
+ db_input high container/preseed-file || true
+ db_go
+
+ db_get container/preseed-file
+ PRESEED_FILE="${RET}" # string (w/ empty)
+
+ echo "PRESEED_FILE=\"${PRESEED_FILE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PRESEED_FILE
+ ;;
+esac
+
+db_stop
diff --git a/share/build-scripts/debconf.d/0001-preseed-file.templates b/share/build-scripts/debconf.d/0001-preseed-file.templates
new file mode 100644
index 0000000..9be825d
--- /dev/null
+++ b/share/build-scripts/debconf.d/0001-preseed-file.templates
@@ -0,0 +1,18 @@
+Template: container/title
+Type: title
+Description: compute-tools
+
+Template: container/preseed-files
+Type: select
+Default: none
+Choices: ${CHOICES}
+Description: Choose a preseed config, enter a custom one, or use no preseed file at all.
+
+Template: container/preseed-file
+Type: string
+Default:
+Description: Enter (optional) preseed file to use:
+ A preseed file can be used to automatically answer questions to this
+ container build script.
+ .
+ If you do not want to use a preseed file, leave this question empty.
diff --git a/share/build-scripts/debconf.d/0002-preseed-debconf b/share/build-scripts/debconf.d/0002-preseed-debconf
new file mode 100755
index 0000000..fcb9006
--- /dev/null
+++ b/share/build-scripts/debconf.d/0002-preseed-debconf
@@ -0,0 +1,111 @@
+#!/bin/sh
+
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+set -e
+
+if [ -e "${DEBCONF_TMPDIR}/debconf.default" ]
+then
+ . "${DEBCONF_TMPDIR}/debconf.default"
+fi
+
+if [ -z "${PRESEED_FILE}" ]
+then
+ # user has not specified or selected any preseed files
+ exit 0
+fi
+
+# user has one or more preseed file specified through commandline option
+# or debconf selection dialog.
+PRESEED_FILES="$(echo ${PRESEED_FILE} | sed -e 's|,| |g')"
+
+DEBCONF_PRESEED_FILES=""
+
+for PRESEED_FILE in ${PRESEED_FILES}
+do
+ if [ ! -e "${PRESEED_FILE}" ]
+ then
+ # preseed file does not exist
+ echo "W: ${PRESEED_FILE}: No such file."
+
+ continue
+ fi
+
+ # add preseed file to debconf
+ DEBCONF_PRESEED_FILES="${DEBCONF_PRESEED_FILES} ${PRESEED_FILE}"
+
+ if ! grep -qs '^ *compute-tools *container/include-preseed-files' "${PRESEED_FILE}"
+ then
+ # preseed file has no includes
+ continue
+ fi
+
+ # preseed file has includes
+ INCLUDE_PRESEED_FILES="$(grep '^ *compute-tools *container/include-preseed-files' ${PRESEED_FILE} | awk '{ $1=$2=$3=""; print $0 }' | sed -e 's|,| |g')"
+
+ # only one include layer is supported, no nested/recursive includes
+ for FILE in ${INCLUDE_PRESEED_FILES}
+ do
+ if [ -e "${FILE}" ]
+ then
+ DEBCONF_PRESEED_FILES="${FILE} ${DEBCONF_PRESEED_FILES}"
+ else
+ # included preseed file does not exist
+ echo "W: ${INCLUDE_PRESEED_FILE}: No such file - included from ${PRESEED_FILE}"
+ fi
+ done
+done
+
+for DEBCONF_PRESEED_FILE in ${DEBCONF_PRESEED_FILES}
+do
+ if [ -e /usr/bin/kdig ]
+ then
+ DIG="/usr/bin/kdig"
+ elif [ -e /usr/bin/dig ]
+ then
+ DIG="/usr/bin/dig"
+ fi
+
+ if [ -n "${DIG}" ]
+ then
+ IPV4_ADDRESS1="$(${DIG} A +short ${NAME} | tail -n1)"
+ IPV4_ADDRESS1_PART1="$(echo ${IPV4_ADDRESS1} | cut -d. -f1)"
+ IPV4_ADDRESS1_PART2="$(echo ${IPV4_ADDRESS1} | cut -d. -f2)"
+ IPV4_ADDRESS1_PART3="$(echo ${IPV4_ADDRESS1} | cut -d. -f3)"
+ IPV4_ADDRESS1_PART4="$(echo ${IPV4_ADDRESS1} | cut -d. -f4)"
+
+ IPV6_ADDRESS1="$(${DIG} AAAA +short ${NAME} | tail -n1)"
+ fi
+
+ sed -e "s|@NAME@|${NAME}|g" \
+ -e "s|@IPV4_ADDRESS1@|${IPV4_ADDRESS1}|g" \
+ -e "s|@IPV4_ADDRESS1_PART1@|${IPV4_ADDRESS1_PART1}|g" \
+ -e "s|@IPV4_ADDRESS1_PART2@|${IPV4_ADDRESS1_PART2}|g" \
+ -e "s|@IPV4_ADDRESS1_PART3@|${IPV4_ADDRESS1_PART3}|g" \
+ -e "s|@IPV4_ADDRESS1_PART4@|${IPV4_ADDRESS1_PART4}|g" \
+ -e "s|@IPV6_ADDRESS1@|${IPV6_ADDRESS1}|g" \
+ "${DEBCONF_PRESEED_FILE}" > "${DIRECTORY}/preseed.cfg"
+
+ # Apply user specified preseed files
+ debconf-set-selections "${DIRECTORY}/preseed.cfg"
+
+ rm -f "${DIRECTORY}/preseed.cfg"
+done
+
+# Write expanded list of debconf preseed files
+echo "PRESEED_FILE=\"${DEBCONF_PRESEED_FILES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
diff --git a/share/build-scripts/debconf.d/0003-debconf b/share/build-scripts/debconf.d/0003-debconf
new file mode 100755
index 0000000..e12e25e
--- /dev/null
+++ b/share/build-scripts/debconf.d/0003-debconf
@@ -0,0 +1,1371 @@
+#!/bin/sh
+
+# Copyright (C) 2014-2022 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+set -e
+
+DEBCONF_NOWARNINGS="true"
+export DEBCONF_NOWARNINGS
+
+. /usr/share/debconf/confmodule
+
+Mode ()
+{
+ db_get container/mode
+ MODE="${RET}" # select
+
+ if [ -z "${MODE}" ]
+ then
+ MODE="$(basename ${SCRIPT})"
+
+ case "${MODE}" in
+ debconf)
+ MODE="debian"
+ ;;
+ esac
+ fi
+
+ echo "MODE=\"${MODE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export MODE
+}
+
+Images ()
+{
+ if db_get container/image && [ "${RET}" ]
+ then
+ db_get container/image
+ IMAGE="${RET}" # string (w/o empty)
+
+ echo "IMAGE=\"${IMAGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ fi
+
+ NUMBER="1"
+
+ while db_get container/image${NUMBER} && [ "${RET}" ]
+ do
+ if db_get container/image${NUMBER}
+ then
+ eval IMAGE${NUMBER}="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ IMAGE_NUMBER="$((${NUMBER} - 1))"
+
+ echo "IMAGE_NUMBER=\"${IMAGE_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${IMAGE_NUMBER})
+ do
+ eval IMAGE="$`echo IMAGE${NUMBER}`"
+ echo "IMAGE${NUMBER}=\"${IMAGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+}
+
+Distribution ()
+{
+ db_get container/distribution
+ DISTRIBUTION="${RET}" # select
+
+ if [ -z "${DISTRIBUTION}" ]
+ then
+ case "${MODE}" in
+ debian)
+ db_subst container/distribution CHOICES "Debian GNU/Linux 10 \"buster\", Debian GNU/Linux 11 \"bullseye\", Debian GNU/Linux 12 \"bookworm\", Debian GNU/Linux testing, Debian GNU/Linux unstable/sid"
+ db_subst container/distribution CHOICES_C "buster, bullseye, bookworm, testing, sid"
+
+ db_set container/distribution bookworm
+ db_fset container/distribution seen false
+ ;;
+
+ progress-linux)
+ db_subst container/distribution CHOICES "Progress Linux 5 (engywuck), Progress Linux 5.99 (engywuck-backports), Progress Linux 6 (fuchur), Progress Linux 6.99 (fuchur-backports), Progress Linux 7 (graograman), Progress Linux 7.99 (graograman-backports)"
+ db_subst container/distribution CHOICES_C "engywuck, engywuck-backports, fuchur, fuchur-backports, graograman, graograman-backports"
+
+ db_set container/distribution graograman-backports
+ db_fset container/distribution seen false
+ ;;
+ esac
+
+ db_settitle container/title
+ db_input high container/distribution || true
+ db_go
+
+ db_get container/distribution
+ DISTRIBUTION="${RET}" # select
+ fi
+
+ echo "DISTRIBUTION=\"${DISTRIBUTION}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export DISTRIBUTION
+}
+
+Parent_distribution ()
+{
+ db_get container/parent-distribution
+ PARENT_DISTRIBUTION="${RET}"
+
+ if [ -z "${PARENT_DISTRIBUTION}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ case "${DISTRIBUTION}" in
+ engywuck*)
+ PARENT_DISTRIBUTION="buster"
+ ;;
+
+ fuchur*)
+ PARENT_DISTRIBUTION="bullseye"
+ ;;
+
+ graograman*)
+ PARENT_DISTRIBUTION="bookworm"
+ ;;
+ esac
+ ;;
+
+ *)
+ PARENT_DISTRIBUTION="${DISTRIBUTION}"
+ ;;
+ esac
+ fi
+
+ echo "PARENT_DISTRIBUTION=\"${PARENT_DISTRIBUTION}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PARENT_DISTRIBUTION
+}
+
+Architecture ()
+{
+ case "$(dpkg --print-architecture)" in
+ amd64)
+ DEFAULT="amd64"
+ CHOICES="Automatic, 32-bit PC (i386), 64-bit PC (amd64)"
+ CHOICES_C="auto, i386, amd64"
+ ;;
+
+ arm64)
+ DEFAULT="arm64"
+ CHOICES="Automatic, RaspberryPi 3 and newer (arm64)"
+ CHOICES_C="auto, arm64"
+ ;;
+
+ i386)
+ case "$(uname -m)" in
+ x86_64)
+ DEFAULT="amd64"
+ CHOICES="Automatic, 32-bit PC (i386), 64-bit PC (amd64)"
+ CHOICES_C="auto, i386, amd64"
+ ;;
+
+ *)
+ DEFAULT="i386"
+ CHOICES=""
+ CHOICES_C=""
+ ;;
+ esac
+ ;;
+
+ *)
+ echo "E: Architecture current not yet supported."
+ exit 1
+ esac
+
+ db_get container/architecture
+ ARCHITECTURE="${RET}" # select
+
+ if [ -z "${ARCHITECTURE}" ] && [ -n "${CHOICES}" ]
+ then
+ db_subst container/architecture CHOICES ${CHOICES}
+ db_subst container/architecture CHOICES_C ${CHOICES_C}
+
+ db_set container/architecture ${DEFAULT}
+ db_fset container/distribution seen false
+
+ db_settitle container/title
+ db_input high container/architecture || true
+ db_go
+
+ db_get container/architecture
+ ARCHITECTURE="${RET}" # select
+ fi
+
+ case "${ARCHITECTURE}" in
+ auto)
+ ARCHITECTURE="${DEFAULT}"
+ ;;
+ esac
+
+ echo "ARCHITECTURE=\"${ARCHITECTURE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export ARCHITECTURE
+}
+
+Archives ()
+{
+ db_get container/archives
+ ARCHIVES="${RET}" # multiselect
+
+ if [ -z "${ARCHIVES}" ]
+ then
+ case "${MODE}" in
+ debian)
+ case "${PARENT_DISTRIBUTION}" in
+ sid)
+ db_subst container/archives CHOICES "sid, experimental"
+
+ db_set container/archives "sid"
+ db_fset container/archives seen false
+ ;;
+
+ *)
+ db_subst container/archives CHOICES "${DISTRIBUTION}, ${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports, ${DISTRIBUTION}-proposed-updates"
+
+ case "${PARENT_DISTRIBUTION}" in
+ sid)
+ db_set container/archives "sid"
+ ;;
+
+ *)
+ db_set container/archives "${DISTRIBUTION}, ${DISTRIBUTION}-security, ${DISTRIBUTION}-updates"
+ ;;
+ esac
+
+ db_fset container/archives seen false
+ ;;
+ esac
+ ;;
+
+ progress-linux)
+ DIST="$(echo ${DISTRIBUTION} | sed -e 's|-backports||')"
+
+ db_subst container/archives CHOICES "${DIST}, ${DIST}-security, ${DIST}-updates, ${DIST}-extras, ${DIST}-backports, ${DIST}-backports-extras"
+
+ db_set container/archives "${DIST}, ${DIST}-security, ${DIST}-updates, ${DIST}-extras, ${DIST}-backports, ${DIST}-backports-extras"
+ db_fset container/archives seen false
+ ;;
+ esac
+
+ db_settitle container/title
+ db_input high container/archives || true
+ db_go
+
+ db_get container/archives
+ ARCHIVES="${RET}" # multiselect
+ fi
+
+ ARCHIVES="$(echo ${ARCHIVES} | sed -e 's|, | |g')"
+
+ echo "ARCHIVES=\"${ARCHIVES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export ARCHIVES
+}
+
+Parent_archives ()
+{
+ db_get container/parent-archives
+ PARENT_ARCHIVES="${RET}" # multiselect (w/o empty)
+
+ if [ -z "${PARENT_ARCHIVES}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ db_subst container/parent-archives CHOICES "${PARENT_DISTRIBUTION}, ${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates, ${PARENT_DISTRIBUTION}-backports, ${PARENT_DISTRIBUTION}-proposed-updates"
+
+ case "${PARENT_DISTRIBUTION}" in
+ *)
+ db_set container/parent-archives "${PARENT_DISTRIBUTION}, ${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates"
+ ;;
+ esac
+
+ db_fset container/parent-archives seen false
+
+ db_settitle container/title
+ db_input high container/parent-archives || true
+ db_go
+ ;;
+
+ *)
+ db_subst container/parent-archives CHOICES "${DISTRIBUTION}, ${DISTRIBUTION}-security, ${DISTRIBUTION}-updates, ${DISTRIBUTION}-backports, ${DISTRIBUTION}-proposed-updates"
+
+ db_set container/parent-archives "${ARCHIVES}"
+ db_fset container/parent-archives seen true
+ ;;
+ esac
+
+ db_get container/parent-archives
+ PARENT_ARCHIVES="${RET}" # multiselect (w/o empty)
+
+ if [ -z "${PARENT_ARCHIVES}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ case "${PARENT_DISTRIBUTION}" in
+ *)
+ PARENT_ARCHIVES="${PARENT_DISTRIBUTION}, ${PARENT_DISTRIBUTION}-security, ${PARENT_DISTRIBUTION}-updates"
+ ;;
+ esac
+ ;;
+
+ *)
+ PARENT_ARCHIVES="${ARCHIVES}"
+ ;;
+ esac
+ fi
+ fi
+
+ PARENT_ARCHIVES="$(echo ${PARENT_ARCHIVES} | sed -e 's|, | |g')"
+
+ echo "PARENT_ARCHIVES=\"${PARENT_ARCHIVES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PARENT_ARCHIVES
+}
+
+Mirror ()
+{
+ db_get container/mirror
+ MIRROR="${RET}"
+
+ if [ -z "${MIRROR}" ]
+ then
+ case "${MODE}" in
+ debian)
+ db_set container/mirror https://deb.debian.org/debian
+ db_fset container/mirror seen false
+ ;;
+
+ progress-linux)
+ db_set container/mirror https://deb.progress-linux.org/packages
+ db_fset container/mirror seen false
+ ;;
+ esac
+
+ db_settitle container/title
+ db_input high container/mirror || true
+ db_go
+
+ db_get container/mirror
+ MIRROR="${RET}" # string (w/o empty)
+
+ if [ -z "${MIRROR}" ]
+ then
+ case "${MODE}" in
+ debian)
+ MIRROR="https://deb.debian.org/debian"
+ ;;
+
+ progress-linux)
+ MIRROR="https://deb.progress-linux.org/packages"
+ ;;
+ esac
+ fi
+ fi
+
+ echo "MIRROR=\"${MIRROR}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export MIRROR
+}
+
+Mirror_security ()
+{
+ if ! echo "${ARCHIVES}" | grep -qs "-security"
+ then
+ return 0
+ fi
+
+ db_get container/mirror-security
+ MIRROR_SECURITY="${RET}" # string (w/o empty)
+
+ if [ -z "${MIRROR_SECURITY}" ]
+ then
+ case "${MODE}" in
+ debian)
+ db_set container/mirror-security https://security.debian.org
+ db_fset container/mirror-security seen false
+ ;;
+
+ *)
+ db_set container/mirror-security ${MIRROR}
+ db_fset container/mirror-security seen true
+ ;;
+ esac
+
+ db_settitle container/title
+ db_input high container/mirror-security || true
+ db_go
+
+ db_get container/mirror-security
+ MIRROR_SECURITY="${RET}" # string (w/o empty)
+
+ if [ -z "${MIRROR_SECURITY}" ]
+ then
+ case "${MODE}" in
+ debian)
+ MIRROR_SECURITY="https://security.debian.org"
+ ;;
+
+ *)
+ MIRROR_SECURITY="${MIRROR}"
+ ;;
+ esac
+ fi
+ fi
+
+ echo "MIRROR_SECURITY=\"${MIRROR_SECURITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export MIRROR_SECURITY
+}
+
+Parent_mirror ()
+{
+ db_get container/parent-mirror
+ PARENT_MIRROR="${RET}" # string (w/o empty)
+
+ if [ -z "${PARENT_MIRROR}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ db_set container/parent-mirror https://deb.debian.org/debian
+ db_fset container/parent-mirror seen false
+
+ db_settitle container/title
+ db_input high container/parent-mirror || true
+ db_go
+ ;;
+
+ *)
+ db_set container/parent-mirror ${MIRROR}
+ db_fset container/parent-mirror seen true
+ ;;
+ esac
+
+ db_get container/parent-mirror
+ PARENT_MIRROR="${RET}" # string (w/o empty)
+
+ if [ -z "${PARENT_MIRROR}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ PARENT_MIRROR="https://deb.debian.org/debian"
+ ;;
+
+ *)
+ PARENT_MIRROR="${MIRROR}"
+ ;;
+ esac
+ fi
+ fi
+
+ echo "PARENT_MIRROR=\"${PARENT_MIRROR}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PARENT_MIRROR
+}
+
+Parent_mirror_security ()
+{
+ if ! echo "${PARENT_ARCHIVES}" | grep -qs "-security"
+ then
+ return 0
+ fi
+
+ db_get container/parent-mirror-security
+ PARENT_MIRROR_SECURITY="${RET}" # string (w/o empty)
+
+ if [ -z "${PARENT_MIRROR_SECURITY}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ db_set container/parent-mirror-security https://security.debian.org
+ db_fset container/parent-mirror-security seen false
+
+ db_settitle container/title
+ db_input high container/parent-mirror-security || true
+ db_go
+ ;;
+
+ *)
+ db_set container/parent-mirror-security ${MIRROR_SECURITY}
+ db_fset container/parent-mirror-security seen true
+ ;;
+ esac
+
+ db_get container/parent-mirror-security
+ PARENT_MIRROR_SECURITY="${RET}" # string (w/o empty)
+
+ if [ -z "${PARENT_MIRROR_SECURITY}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ PARENT_MIRROR_SECURITY="https://security.debian.org"
+ ;;
+
+ *)
+ PARENT_MIRROR_SECURITY="${MIRROR_SECURITY}"
+ ;;
+ esac
+ fi
+ fi
+
+ echo "PARENT_MIRROR_SECURITY=\"${PARENT_MIRROR_SECURITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PARENT_MIRROR_SECURITY
+}
+
+Archive_areas ()
+{
+ db_get container/archive-areas
+ ARCHIVE_AREAS="${RET}"
+
+ case "${PARENT_DISTRIBUTION}" in
+ bookworm|testing|sid)
+ ARCHIVE_AREAS_ALL="main, contrib, non-free, non-free-firmware"
+ ;;
+
+ *)
+ ARCHIVE_AREAS_ALL="main, contrib, non-free"
+ ;;
+ esac
+
+ if [ -z "${ARCHIVE_AREAS}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ db_subst container/archive-areas CHOICES "${ARCHIVE_AREAS_ALL}"
+
+ db_set container/archive-areas "${ARCHIVE_AREAS_ALL}"
+ db_fset container/archive-areas seen false
+ ;;
+
+ *)
+ db_subst container/archive-areas CHOICES "${ARCHIVE_AREAS_ALL}"
+
+ db_set container/archive-areas "main"
+ db_fset container/archive-areas seen false
+ ;;
+ esac
+
+ db_settitle container/title
+ db_input high container/archive-areas || true
+ db_go
+
+ db_get container/archive-areas
+ ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
+
+ if [ -z "${ARCHIVE_AREAS}" ]
+ then
+ case "${MODE}" in
+ debian)
+ ARCHIVE_AREAS="main"
+ ;;
+
+ progress-linux)
+ ARCHIVE_AREAS="${ARCHIVE_AREAS_ALL}"
+ ;;
+ esac
+ fi
+ fi
+
+ ARCHIVE_AREAS="$(echo ${ARCHIVE_AREAS} | sed -e 's| ||g')"
+
+ echo "ARCHIVE_AREAS=\"${ARCHIVE_AREAS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export ARCHIVE_AREAS
+}
+
+Parent_archive_areas ()
+{
+ db_get container/parent-archive-areas
+ PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
+
+ case "${PARENT_DISTRIBUTION}" in
+ bookworm|testing|sid)
+ PARENT_ARCHIVE_AREAS_ALL="main, contrib, non-free, non-free-firmware"
+ ;;
+
+ *)
+ PARENT_ARCHIVE_AREAS_ALL="main, contrib, non-free"
+ ;;
+ esac
+
+ if [ -z "${PARENT_ARCHIVE_AREAS}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ db_subst container/parent-archive-areas CHOICES "${PARENT_ARCHIVE_AREAS_ALL}"
+
+ db_set container/parent-archive-areas "${PARENT_ARCHIVE_AREAS_ALL}"
+ db_fset container/parent-archive-areas seen false
+
+ db_settitle container/title
+ db_input high container/parent-archive-areas || true
+ db_go
+ ;;
+
+ *)
+ db_subst container/parent-archive-areas CHOICES "${ARCHIVE_AREAS}"
+
+ db_set container/parent-archive-areas "${ARCHIVE_AREAS}"
+ db_fset container/parent-archive-areas seen true
+ ;;
+ esac
+
+ db_get container/parent-archive-areas
+ PARENT_ARCHIVE_AREAS="${RET}" # multiselect (w/o empty)
+
+ if [ -z "${PARENT_ARCHIVE_AREAS}" ]
+ then
+ case "${MODE}" in
+ progress-linux)
+ PARENT_ARCHIVE_AREAS="${PARENT_ARCHIVE_AREAS_ALL}"
+ ;;
+
+ *)
+ PARENT_ARCHIVE_AREAS="${ARCHIVE_AREAS}"
+ ;;
+ esac
+ fi
+ fi
+
+ PARENT_ARCHIVE_AREAS="$(echo ${PARENT_ARCHIVE_AREAS} | sed -e 's| ||g')"
+
+ echo "PARENT_ARCHIVE_AREAS=\"${PARENT_ARCHIVE_AREAS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PARENT_ARCHIVE_AREAS
+}
+
+Packages ()
+{
+ db_get container/packages
+ PACKAGES="${RET}" # string (w/ empty)
+
+ if [ -z "${PACKAGES}" ]
+ then
+ db_settitle container/title
+ db_input high container/packages || true
+ db_go
+
+ db_get container/packages
+ PACKAGES="${RET}" # string (w/ empty)
+ fi
+
+ echo "PACKAGES=\"${PACKAGES}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ export PACKAGES
+}
+
+Local_archives ()
+{
+ NUMBER="1"
+
+ while db_get container/archive${NUMBER}/repository && [ "${RET}" ]
+ do
+ mkdir -p "${DEBCONF_TMPDIR}/apt"
+
+ REPOSITORY="${RET#deb }"
+
+ LIST="archive${NUMBER}.list"
+ if db_get container/archive${NUMBER}/list
+ then
+ LIST="$(basename ${RET} .list).list"
+ fi
+
+ COMMENT=""
+ if db_get container/archive${NUMBER}/comment
+ then
+ COMMENT="${RET}"
+
+ echo "# ${COMMENT}" > "${DEBCONF_TMPDIR}/apt/${LIST}"
+ fi
+
+ echo "deb ${REPOSITORY}" >> "${DEBCONF_TMPDIR}/apt/${LIST}"
+
+ if db_get container/archive${NUMBER}/source && [ "$RET" = true ]
+ then
+ echo "deb-src ${REPOSITORY}" >> "${DEBCONF_TMPDIR}/apt/${LIST}"
+ fi
+
+ KEY=""
+ if db_get container/archive${NUMBER}/key
+ then
+ KEY="${RET}"
+
+ wget -q "${KEY}" -O "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .list).key"
+ fi
+
+ PREFERENCES_PACKAGE=""
+ PREFERENCES_PIN=""
+ PREFERENCES_PIN_PRIORITY=""
+ if db_get container/archive${NUMBER}/preferences-package
+ then
+ PREFERENCES_PACKAGE="${RET}"
+
+ if db_get container/archive${NUMBER}/preferences-pin
+ then
+ PREFERENCES_PIN="${RET}"
+ fi
+
+ if db_get container/archive${NUMBER}/preferences-pin-priority
+ then
+ PREFERENCES_PIN_PRIORITY="${RET}"
+ fi
+
+ if [ -n "${PREFERENCES_PACKAGE}" ] || [ -n "${PREFERENCES_PIN}" ] || [ -n "${PREFERENCES_PIN_PRIORITY}" ]
+ then
+
+cat > "${DEBCONF_TMPDIR}/apt/$(basename ${LIST} .list).pref" << EOF
+Package: ${PREFERENCES_PACKAGE}
+Pin: ${PREFERENCES_PIN}
+Pin-Priority: ${PREFERENCES_PIN_PRIORITY}
+EOF
+
+ fi
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+}
+
+Network_defaults ()
+{
+ HOSTNAME_SHORT="$(echo veth-$(echo ${NAME} | cut -c-8)-0)"
+ VETH_NAME="${HOSTNAME_SHORT}"
+
+ NETWORK1_VETH="${NETWORK1_VETH:-$VETH_NAME}"
+ NETWORK1_BRIDGE="${NETWORK1_BRIDGE:-bridge0}"
+
+ NETWORK1_IPV4_METHOD="${NETWORK1_IPV4_METHOD:-dhcp}"
+ NETWORK1_IPV4_ADDRESS="${NETWORK1_IPV4_ADDRESS:-192.168.1.2}"
+ NETWORK1_IPV4_NETMASK="${NETWORK1_IPV4_NETMASK:-24}"
+
+ NETWORK1_IPV6_METHOD="${NETWORK1_IPV6_METHOD:-none}"
+ NETWORK1_IPV6_ADDRESS="${NETWORK1_IPV6_ADDRESS:-fc00::2}"
+ NETWORK1_IPV6_NETMASK="${NETWORK1_IPV6_NETMASK:-7}"
+
+ if [ "${NETWORK1_IPV4_METHOD}" = "static" ] || [ "${NETWORK1_IPV6_METHOD}" = "static" ]
+ then
+ if [ -e /etc/resolv.conf ]
+ then
+ NAMESERVER_SERVER="${NAMESERVER_SERVER:-$(awk '/^nameserver / {$1=""; print $0}' /etc/resolv.conf)}"
+ # Workaround to get rid of newlines since debconf can not handle multiline return value in assignments
+ NAMESERVER_SERVER="$(echo ${NAMESERVER_SERVER})"
+
+ NAMESERVER_DOMAIN="${NAMESERVER_DOMAIN:-$(awk '/^domain / {$1=""; print $0}' /etc/resolv.conf)}"
+ NAMESERVER_SEARCH="${NAMESERVER_SEARCH:-$(awk '/^search / {$1=""; print $0}' /etc/resolv.conf)}"
+ NAMESERVER_OPTIONS="${NAMESERVER_OPTIONS:-$(awk '/^options / {$1=""; print $0}' /etc/resolv.conf)}"
+ fi
+ fi
+}
+
+Network ()
+{
+ db_get container/network1/bridge
+ NETWORK1_BRIDGE="${RET}" # string (w/o empty)
+
+ db_get container/network1/veth
+ NETWORK1_VETH="${RET}" # string (w/o empty)
+
+ db_get container/network1/ipv4-method
+ NETWORK1_IPV4_METHOD="${RET}" # select
+
+ db_get container/network1/ipv4-comment
+ NETWORK1_IPV4_COMMENT="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv4-address
+ NETWORK1_IPV4_ADDRESS="${RET}" # string (w/o empty)
+
+ db_get container/network1/ipv4-gateway
+ NETWORK1_IPV4_GATEWAY="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv4-netmask
+ NETWORK1_IPV4_NETMASK="${RET}" # string (w/o empty)
+
+ db_get container/network1/ipv4-post-up
+ NETWORK1_IPV4_POST_UP="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv4-post-down
+ NETWORK1_IPV4_POST_DOWN="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv6-method
+ NETWORK1_IPV6_METHOD="${RET}" # select
+
+ db_get container/network1/ipv6-comment
+ NETWORK1_IPV6_COMMENT="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv6-address
+ NETWORK1_IPV6_ADDRESS="${RET}" # string (w/o empty)
+
+ db_get container/network1/ipv6-gateway
+ NETWORK1_IPV6_GATEWAY="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv6-netmask
+ NETWORK1_IPV6_NETMASK="${RET}" # string (w/o empty)
+
+ db_get container/network1/ipv6-post-up
+ NETWORK1_IPV6_POST_UP="${RET}" # string (w/ empty)
+
+ db_get container/network1/ipv6-post-down
+ NETWORK1_IPV6_POST_DOWN="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/server
+ NAMESERVER_SERVER="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/domain
+ NAMESERVER_DOMAIN="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/search
+ NAMESERVER_SEARCH="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/options
+ NAMESERVER_OPTIONS="${RET}" # string (w/ empty)
+
+ Network_defaults
+
+ db_set container/network1/bridge "${NETWORK1_BRIDGE}"
+ db_fset container/network1/bridge seen false
+
+ db_set container/network1/veth "${NETWORK1_VETH}"
+ db_fset container/network1/veth seen false
+
+ db_set container/network1/ipv4-method "${NETWORK1_IPV4_METHOD}"
+ db_fset container/network1/ipv4-method seen false
+
+ db_set container/network1/ipv4-comment "${NETWORK1_IPV4_COMMENT}"
+ db_fset container/network1/ipv4-comment seen false
+
+ db_set container/network1/ipv4-address "${NETWORK1_IPV4_ADDRESS}"
+ db_fset container/network1/ipv4-address seen false
+
+ db_set container/network1/ipv4-gateway "${NETWORK1_IPV4_GATEWAY}"
+ db_fset container/network1/ipv4-gateway seen false
+
+ db_set container/network1/ipv4-netmask "${NETWORK1_IPV4_NETMASK}"
+ db_fset container/network1/ipv4-netmask seen false
+
+ db_set container/network1/ipv4-post-up "${NETWORK1_IPV4_POST_UP}"
+ db_fset container/network1/ipv4-post-up seen false
+
+ db_set container/network1/ipv4-post-down "${NETWORK1_IPV4_POST_DOWN}"
+ db_fset container/network1/ipv4-post-down seen false
+
+ db_set container/network1/ipv6-method "${NETWORK1_IPV6_METHOD}"
+ db_fset container/network1/ipv6-method seen false
+
+ db_set container/network1/ipv6-comment "${NETWORK1_IPV6_COMMENT}"
+ db_fset container/network1/ipv6-comment seen false
+
+ db_set container/network1/ipv6-address "${NETWORK1_IPV6_ADDRESS}"
+ db_fset container/network1/ipv6-address seen false
+
+ db_set container/network1/ipv6-gateway "${NETWORK1_IPV6_GATEWAY}"
+ db_fset container/network1/ipv6-gateway seen false
+
+ db_set container/network1/ipv6-netmask "${NETWORK1_IPV6_NETMASK}"
+ db_fset container/network1/ipv6-netmask seen false
+
+ db_set container/network1/ipv6-post-up "${NETWORK1_IPV6_POST_UP}"
+ db_fset container/network1/ipv6-post-up seen false
+
+ db_set container/network1/ipv6-post-down "${NETWORK1_IPV6_POST_DOWN}"
+ db_fset container/network1/ipv6-post-down seen false
+
+ db_set container/nameserver/server "${NAMESERVER_SERVER}"
+ db_fset container/nameserver/server seen false
+
+ db_set container/nameserver/domain "${NAMESERVER_DOMAIN}"
+ db_fset container/nameserver/domain seen false
+
+ db_set container/nameserver/search "${NAMESERVER_SEARCH}"
+ db_fset container/nameserver/search seen false
+
+ db_set container/nameserver/options "${NAMESERVER_OPTIONS}"
+ db_fset container/nameserver/options seen false
+
+ db_get container/network1/bridge
+ NETWORK1_BRIDGE="${RET}" # select
+
+ db_get container/network1/veth
+ NETWORK1_VETH="${RET}" # select
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-method || true
+ db_go
+
+ db_get container/network1/ipv4-method
+ NETWORK1_IPV4_METHOD="${RET}" # select
+
+ case "${NETWORK1_IPV4_METHOD}" in
+ none|dhcp)
+ ;;
+
+ static)
+ db_settitle container/title
+ db_input high container/network1/ipv4-comment || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-address || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-gateway || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-netmask || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-post-up || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-post-down || true
+ db_go
+ ;;
+
+ stub)
+ db_settitle container/title
+ db_input high container/network1/ipv4-comment || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-post-up || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv4-post-down || true
+ db_go
+ ;;
+ esac
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-method || true
+ db_go
+
+ db_get container/network1/ipv6-method
+ NETWORK1_IPV6_METHOD="${RET}" # select
+
+ case "${NETWORK1_IPV6_METHOD}" in
+ none|dhcp)
+ ;;
+
+ static)
+ db_settitle container/title
+ db_input high container/network1/ipv6-comment || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-address || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-gateway || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-netmask || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-post-up || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-post-down || true
+ db_go
+ ;;
+
+ stub)
+ db_settitle container/title
+ db_input high container/network1/ipv6-comment || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-post-up || true
+ db_go
+
+ db_settitle container/title
+ db_input high container/network1/ipv6-post-down || true
+ db_go
+ ;;
+ esac
+
+ if [ "${NETWORK1_IPV4_METHOD}" = "static" ] || [ "${NETWORK1_IPV6_METHOD}" = "static" ]
+ then
+ db_settitle container/title
+ db_input high container/nameserver/server || true
+ db_go
+ fi
+
+ NUMBER="1"
+
+ while ( db_get container/network${NUMBER}/ipv4-method && [ "${RET}" ] ) || ( db_get container/network${NUMBER}/ipv6-method && [ "${RET}" ] )
+ do
+ if db_get container/network${NUMBER}/bridge
+ then
+ eval NETWORK${NUMBER}_BRIDGE="\"${RET}\"" # string (w/o empty)
+ fi
+
+ if db_get container/network${NUMBER}/veth
+ then
+ eval NETWORK${NUMBER}_VETH="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ NETWORK_NUMBER="$((${NUMBER} - 1))"
+
+ for NUMBER in $(seq 1 ${NETWORK_NUMBER})
+ do
+ if db_get container/network${NUMBER}/ipv4-comment
+ then
+ eval NETWORK${NUMBER}_IPV4_COMMENT="\"${RET}\"" # string (w/ empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv4-method
+ then
+ eval NETWORK${NUMBER}_IPV4_METHOD="\"${RET}\"" # select
+ fi
+
+ if db_get container/network${NUMBER}/ipv4-address
+ then
+ eval NETWORK${NUMBER}_IPV4_ADDRESS="\"${RET}\"" # string (w/o empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv4-gateway
+ then
+ eval NETWORK${NUMBER}_IPV4_GATEWAY="\"${RET}\"" # string (w/ empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv4-netmask
+ then
+ eval NETWORK${NUMBER}_IPV4_NETMASK="\"${RET}\"" # string (w/o empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv4-post-up
+ then
+ eval NETWORK${NUMBER}_IPV4_POST_UP="\"${RET}\"" # string (w/ empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv4-post-down
+ then
+ eval NETWORK${NUMBER}_IPV4_POST_DOWN="\"${RET}\"" # string (w/ empty)
+ fi
+ done
+
+ for NUMBER in $(seq 1 ${NETWORK_NUMBER})
+ do
+ if db_get container/network${NUMBER}/ipv6-comment
+ then
+ eval NETWORK${NUMBER}_IPV6_COMMENT="\"${RET}\"" # string (w/ empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv6-method
+ then
+ eval NETWORK${NUMBER}_IPV6_METHOD="\"${RET}\"" # select
+ fi
+
+ if db_get container/network${NUMBER}/ipv6-address
+ then
+ eval NETWORK${NUMBER}_IPV6_ADDRESS="\"${RET}\"" # string (w/o empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv6-gateway
+ then
+ eval NETWORK${NUMBER}_IPV6_GATEWAY="\"${RET}\"" # string (w/ empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv6-netmask
+ then
+ eval NETWORK${NUMBER}_IPV6_NETMASK="\"${RET}\"" # string (w/o empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv6-post-up
+ then
+ eval NETWORK${NUMBER}_IPV6_POST_UP="\"${RET}\"" # string (w/ empty)
+ fi
+
+ if db_get container/network${NUMBER}/ipv6-post-down
+ then
+ eval NETWORK${NUMBER}_IPV6_POST_DOWN="\"${RET}\"" # string (w/ empty)
+ fi
+ done
+
+ db_get container/nameserver/server
+ NAMESERVER_SERVER="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/domain
+ NAMESERVER_DOMAIN="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/search
+ NAMESERVER_SEARCH="${RET}" # string (w/ empty)
+
+ db_get container/nameserver/options
+ NAMESERVER_OPTIONS="${RET}" # string (w/ empty)
+
+ Network_defaults
+
+ echo "NETWORK_NUMBER=\"${NETWORK_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${NETWORK_NUMBER})
+ do
+ eval BRIDGE="$`echo NETWORK${NUMBER}_BRIDGE`"
+ echo "NETWORK${NUMBER}_BRIDGE=\"${BRIDGE}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval VETH="$`echo NETWORK${NUMBER}_VETH`"
+ echo "NETWORK${NUMBER}_VETH=\"${VETH}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval COMMENT="$`echo NETWORK${NUMBER}_IPV4_COMMENT`"
+ echo "NETWORK${NUMBER}_IPV4_COMMENT=\"${COMMENT}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`"
+ echo "NETWORK${NUMBER}_IPV4_METHOD=\"${METHOD}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval ADDRESS="$`echo NETWORK${NUMBER}_IPV4_ADDRESS`"
+ echo "NETWORK${NUMBER}_IPV4_ADDRESS=\"${ADDRESS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval GATEWAY="$`echo NETWORK${NUMBER}_IPV4_GATEWAY`"
+ echo "NETWORK${NUMBER}_IPV4_GATEWAY=\"${GATEWAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval NETMASK="$`echo NETWORK${NUMBER}_IPV4_NETMASK`"
+ echo "NETWORK${NUMBER}_IPV4_NETMASK=\"${NETMASK}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval POST_UP="$`echo NETWORK${NUMBER}_IPV4_POST_UP`"
+ echo "NETWORK${NUMBER}_IPV4_POST_UP=\"${POST_UP}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval POST_DOWN="$`echo NETWORK${NUMBER}_IPV4_POST_DOWN`"
+ echo "NETWORK${NUMBER}_IPV4_POST_DOWN=\"${POST_DOWN}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval COMMENT="$`echo NETWORK${NUMBER}_IPV6_COMMENT`"
+ echo "NETWORK${NUMBER}_IPV6_COMMENT=\"${COMMENT}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval METHOD="$`echo NETWORK${NUMBER}_IPV6_METHOD`"
+ echo "NETWORK${NUMBER}_IPV6_METHOD=\"${METHOD}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval ADDRESS="$`echo NETWORK${NUMBER}_IPV6_ADDRESS`"
+ echo "NETWORK${NUMBER}_IPV6_ADDRESS=\"${ADDRESS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval GATEWAY="$`echo NETWORK${NUMBER}_IPV6_GATEWAY`"
+ echo "NETWORK${NUMBER}_IPV6_GATEWAY=\"${GATEWAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval NETMASK="$`echo NETWORK${NUMBER}_IPV6_NETMASK`"
+ echo "NETWORK${NUMBER}_IPV6_NETMASK=\"${NETMASK}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval POST_UP="$`echo NETWORK${NUMBER}_IPV6_POST_UP`"
+ echo "NETWORK${NUMBER}_IPV6_POST_UP=\"${POST_UP}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ eval POST_DOWN="$`echo NETWORK${NUMBER}_IPV6_POST_DOWN`"
+ echo "NETWORK${NUMBER}_IPV6_POST_DOWN=\"${POST_DOWN}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+
+ echo "NAMESERVER_SERVER=\"${NAMESERVER_SERVER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ echo "NAMESERVER_DOMAIN=\"${NAMESERVER_DOMAIN}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ echo "NAMESERVER_SEARCH=\"${NAMESERVER_SEARCH}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ echo "NAMESERVER_OPTIONS=\"${NAMESERVER_OPTIONS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+}
+
+Root_password ()
+{
+ if db_get container/root-password
+ then
+ ROOT_PASSWORD="${RET}" # string (w/o empty)
+ fi
+
+ if [ -z "${ROOT_PASSWORD}" ]
+ then
+ # Create a random password as suggestion for the user
+ RANDOM_PASSWORD="$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)"
+
+ db_set container/root-password ${RANDOM_PASSWORD}
+ db_fset container/root-password seen false
+
+ db_settitle container/title
+ db_input high container/root-password || true
+ db_go
+
+ db_get container/root-password
+ ROOT_PASSWORD="${RET}"
+
+ if [ -z "${ROOT_PASSWORD}" ]
+ then
+ # User did set not set a password, falling back to random password
+ ROOT_PASSWORD="${RANDOM_PASSWORD}"
+ fi
+
+ if [ "${ROOT_PASSWORD}" = "${RANDOM_PASSWORD}" ]
+ then
+ echo "ROOT_RANDOM_PASSWORD=\"true\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ fi
+ fi
+
+ echo "ROOT_PASSWORD=\"${ROOT_PASSWORD}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+}
+
+Internal_options ()
+{
+ if db_get container/apt-recommends
+ then
+ APT_RECOMMENDS="${RET}" # boolean (w/ empty)
+ fi
+
+ echo "APT_RECOMMENDS=\"${APT_RECOMMENDS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/debconf-frontend
+ then
+ DEBCONF_FRONTEND="${RET}" # select
+ fi
+
+ DEBCONF_FRONTEND="${DEBCONF_FRONTEND:-dialog}"
+ echo "DEBCONF_FRONTEND=\"${DEBCONF_FRONTEND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/debconf-priority
+ then
+ DEBCONF_PRIORITY="${RET}" # select
+ fi
+
+ DEBCONF_PRIORITY="${DEBCONF_PRIORITY:-high}"
+ echo "DEBCONF_PRIORITY=\"${DEBCONF_PRIORITY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/container-command
+ then
+ CONTAINER_COMMAND="${RET}" # string (w/ empty)
+ fi
+
+ echo "CONTAINER_COMMAND=\"${CONTAINER_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ NUMBER="1"
+
+ while db_get container/container-command${NUMBER} && [ "${RET}" ]
+ do
+ if db_get container/container-command${NUMBER}
+ then
+ eval CONTAINER_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ CONTAINER_COMMAND_NUMBER="$((${NUMBER} - 1))"
+
+ echo "CONTAINER_COMMAND_NUMBER=\"${CONTAINER_COMMAND_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${CONTAINER_COMMAND_NUMBER})
+ do
+ eval COMMAND="$`echo CONTAINER_COMMAND${NUMBER}`"
+ echo "CONTAINER_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+
+ if db_get container/host-command
+ then
+ HOST_COMMAND="${RET}" # string (w/ empty)
+ fi
+
+ echo "HOST_COMMAND=\"${HOST_COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ NUMBER="1"
+
+ while db_get container/host-command${NUMBER} && [ "${RET}" ]
+ do
+ if db_get container/host-command${NUMBER}
+ then
+ eval HOST_COMMAND${NUMBER}="\"${RET}\"" # string (w/o empty)
+ fi
+
+ NUMBER="$((${NUMBER} + 1))"
+ done
+
+ HOST_COMMAND_NUMBER="$((${NUMBER} - 1))"
+
+ echo "HOST_COMMAND_NUMBER=\"${HOST_COMMAND_NUMBER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ for NUMBER in $(seq 1 ${HOST_COMMAND_NUMBER})
+ do
+ eval COMMAND="$`echo HOST_COMMAND${NUMBER}`"
+ echo "HOST_COMMAND${NUMBER}=\"${COMMAND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+ done
+
+ if db_get container/auto
+ then
+ CNT_AUTO="${RET:-last-on}" # string (w/o empty)
+ fi
+
+ CNT_AUTO="${CNT_AUTO:-last-on}"
+ echo "CNT_AUTO=\"${CNT_AUTO}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/container-server
+ then
+ CNT_CONTAINER_SERVER="${RET:-FQDN}" # string (w/o empty)
+ fi
+
+ CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-FQDN}"
+
+ case "${CNT_CONTAINER_SERVER}" in
+ FQDN)
+ CNT_CONTAINER_SERVER="$(hostname -f 2> /dev/null || hostname)"
+ ;;
+ esac
+
+ echo "CNT_CONTAINER_SERVER=\"${CNT_CONTAINER_SERVER}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/bind
+ then
+ BIND="${RET}" # string (w/ empty)
+ fi
+
+ echo "BIND=\"${BIND}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/bind-ro
+ then
+ BIND_RO="${RET}" # string (w/ empty)
+ fi
+
+ echo "BIND_RO=\"${BIND_RO}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/overlay
+ then
+ CNT_OVERLAY="${RET}" # string (w/ empty)
+ fi
+
+ echo "CNT_OVERLAY=\"${CNT_OVERLAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+
+ if db_get container/overlay-options
+ then
+ CNT_OVERLAY_OPTIONS="${RET}" # string (w/ empty)
+ fi
+
+ echo "CNT_OVERLAY_OPTIONS=\"${CNT_OVERLAY_OPTIONS}\"" >> "${DEBCONF_TMPDIR}/debconf.default"
+}
+
+Mode
+Images
+
+Distribution
+Parent_distribution
+
+Architecture
+
+Archives
+Parent_archives
+
+Mirror
+Mirror_security
+
+Parent_mirror
+Parent_mirror_security
+
+Archive_areas
+Parent_archive_areas
+
+Packages
+Local_archives
+
+Network
+Root_password
+
+Internal_options
+
+db_stop
diff --git a/share/build-scripts/debconf.d/0003-debconf.templates b/share/build-scripts/debconf.d/0003-debconf.templates
new file mode 100644
index 0000000..551033a
--- /dev/null
+++ b/share/build-scripts/debconf.d/0003-debconf.templates
@@ -0,0 +1,276 @@
+Template: container/title
+Type: title
+Description: compute-tools
+
+Template: container/mode
+Type: select
+Default:
+Choices-C: ${CHOICES_C}
+Choices: ${CHOICES}
+Description: Mode
+ Mode.
+
+Template: container/image
+Type: string
+Default:
+Description: Image
+ Image.
+
+Template: container/distribution
+Type: select
+Default:
+Choices-C: ${CHOICES_C}
+Choices: ${CHOICES}
+Description: Distribution
+ Distribution.
+
+Template: container/parent-distribution
+Type: select
+Default:
+Choices-C: ${CHOICES_C}
+Choices: ${CHOICES}
+Description: for internal use; can be preseeded
+ Parent Distribution.
+
+Template: container/architecture
+Type: select
+Default:
+Choices-C: ${CHOICES_C}
+Choices: ${CHOICES}
+Description: Architecture
+ Architecture.
+
+Template: container/archives
+Type: multiselect
+Default:
+Choices: ${CHOICES}
+Description: Archives
+ Archives.
+
+Template: container/parent-archives
+Type: multiselect
+Default:
+Choices: ${CHOICES}
+Description: Parent Archives
+ Parent Archives.
+
+Template: container/mirror
+Type: string
+Default:
+Description: Mirror
+ Mirror.
+
+Template: container/mirror-security
+Type: string
+Default:
+Description: Mirror Security
+ Mirror Security.
+
+Template: container/parent-mirror
+Type: string
+Default:
+Description: Parent Mirror
+ Parent Mirror.
+
+Template: container/parent-mirror-security
+Type: string
+Default:
+Description: Parent Mirror Security
+ Parent Mirror Security.
+
+Template: container/archive-areas
+Type: multiselect
+Default:
+Choices: ${CHOICES}
+Description: Archive Areas
+ Archive Areas.
+
+Template: container/parent-archive-areas
+Type: multiselect
+Default:
+Choices: ${CHOICES}
+Description: Parent Archive Areas
+ Parent Archive Areas.
+
+Template: container/packages
+Type: string
+Default:
+Description: Packages
+ Packages.
+
+Template: container/root-password
+Type: string
+Default:
+Description: Root password
+ Root password.
+
+Template: container/network1/bridge
+Type: string
+Default:
+Description: Bridge
+ Bridge.
+
+Template: container/network1/veth
+Type: string
+Default:
+Description: Veth name
+ Veth name.
+
+Template: container/network1/ipv4-method
+Type: select
+Choices: dhcp, static, stub, none
+Default:
+Description: Ethernet Interface Method (IPv4)?
+ What method should be used to configure the ethernet interface?
+ .
+ This defaults to dhcp and will require that you run a dhcp-server in your
+ network.
+
+Template: container/network1/ipv4-comment
+Type: string
+Default:
+Description: Ethernet Interface Comment (IPv4)?
+ What optional comment would you like to give to the ethernet interface?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv4-address
+Type: string
+Default:
+Description: Ethernet IP Address (IPv4)?
+ What should be the IP address of the current system?
+ .
+ This defaults to 192.168.1.2.
+
+Template: container/network1/ipv4-gateway
+Type: string
+Default:
+Description: Ethernet Gateway Address (IPv4)?
+ What should be the gateway address of the current system?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv4-netmask
+Type: string
+Default:
+Description: Ethernet Network Mask (IPv4)?
+ What should be the netmask of the current system?
+ .
+ Note that only the suffix is supported, e.g. '24'
+ for /24 or '16' for /16.
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv4-post-up
+Type: string
+Default:
+Description: Ethernet post-up Command (IPv4)?
+ What should be the post-up command for eno1?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv4-post-down
+Type: string
+Default:
+Description: Ethernet post-down Command (IPv4)?
+ What should be the post-down command for eno1?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv6-method
+Type: select
+Choices: dhcp, static, stub, none
+Default:
+Description: Ethernet Interface Method (IPv6)?
+ What method should be used to configure the ethernet interface?
+ .
+ This defaults to none.
+
+Template: container/network1/ipv6-comment
+Type: string
+Default:
+Description: Ethernet Interface Comment (IPv6)?
+ What optional comment would you like to give to the ethernet interface?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv6-address
+Type: string
+Default:
+Description: Ethernet IP Address (IPv6)?
+ What should be the IP address of the current system?
+ .
+ This defaults to fc00::1 (unique local unicast).
+
+Template: container/network1/ipv6-gateway
+Type: string
+Default:
+Description: Ethernet Gateway Address (IPv6)?
+ What should be the gateway address of the current system?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv6-netmask
+Type: string
+Default:
+Description: Ethernet Network Mask (IPv6)?
+ What should be the netmask of the current system?
+ .
+ Note that only the suffix is supported, e.g. '64'
+ for /64 or '48' for /48.
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv6-post-up
+Type: string
+Default:
+Description: Ethernet post-up Command (IPv6)?
+ What should be the post-up command for eno1?
+ .
+ This defaults to empty.
+
+Template: container/network1/ipv6-post-down
+Type: string
+Default:
+Description: Ethernet post-down Command (IPv6)?
+ What should be the post-down command for eno1?
+ .
+ This defaults to empty.
+
+Template: container/nameserver/server
+Type: string
+Default:
+Description: Nameserver Addresses?
+ What should be the IP addresses of the nameservers of the current system?
+ .
+ This defaults to empty. Multiple nameservers can be separated by whitespace.
+
+Template: container/nameserver/domain
+Type: string
+Default:
+Description: Nameserver Local Domain Name?
+ What should be local domain name used for name resolution?
+ .
+ See resolv.conf(5) for more information about the 'domain' option.
+ .
+ This defaults to empty.
+
+Template: container/nameserver/search
+Type: string
+Default:
+Description: Nameserver Search List?
+ What should be search list for hostname lookups?
+ .
+ See resolv.conf(5) for more information about the 'search' option.
+ .
+ This defaults to empty.
+
+Template: container/nameserver/options
+Type: string
+Default:
+Description: Nameserver Resolver Options?
+ What should be the resolver options?
+ .
+ See resolv.conf(5) for more information about the 'options' option.
+ .
+ This defaults to empty.