From a886751a87e8831df47a7ce9c9952902e7a5623d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 22 Jul 2017 12:48:59 +0200 Subject: Adding cnt-debconf/mode preseed field to allow embedding container create script within preseed file itself without relying on a specific default create script being set on the host system, thanks to David Kunz for the idea. Signed-off-by: Daniel Baumann --- share/scripts/debconf.d/0003-debconf | 22 ++++++++++++++++++++++ share/scripts/debconf.d/0003-debconf.templates | 8 ++++++++ 2 files changed, 30 insertions(+) (limited to 'share/scripts/debconf.d') diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf index 8e78b3e..007ddfb 100755 --- a/share/scripts/debconf.d/0003-debconf +++ b/share/scripts/debconf.d/0003-debconf @@ -23,6 +23,26 @@ export DEBCONF_NOWARNINGS . /usr/share/debconf/confmodule +Mode () +{ + db_get cnt-debconf/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 +} + Distribution () { db_get cnt-debconf/distribution @@ -1044,6 +1064,8 @@ Internal_options () echo "CNT_OVERLAY=\"${CNT_OVERLAY}\"" >> "${DEBCONF_TMPDIR}/debconf.default" } +Mode + Distribution Parent_distribution diff --git a/share/scripts/debconf.d/0003-debconf.templates b/share/scripts/debconf.d/0003-debconf.templates index e46fa88..61b8154 100644 --- a/share/scripts/debconf.d/0003-debconf.templates +++ b/share/scripts/debconf.d/0003-debconf.templates @@ -2,6 +2,14 @@ Template: cnt-debconf/title Type: title Description: container-tools +Template: cnt-debconf/mode +Type: select +Default: +Choices-C: ${CHOICES_C} +Choices: ${CHOICES} +Description: Mode + Mode. + Template: cnt-debconf/distribution Type: select Default: -- cgit v1.2.3