summaryrefslogtreecommitdiffstats
path: root/share/scripts/debconf.d/0001-preseed-file
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-18 15:12:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-02-18 15:12:33 +0000
commitb609b560db2c50b53a7243e257b0692dd612ad06 (patch)
tree140ac1a219edd21244fc1f2d5989342aa7711f0c /share/scripts/debconf.d/0001-preseed-file
parentAdding upstream version 20180118. (diff)
downloadopen-infrastructure-compute-tools-b609b560db2c50b53a7243e257b0692dd612ad06.tar.xz
open-infrastructure-compute-tools-b609b560db2c50b53a7243e257b0692dd612ad06.zip
Adding upstream version 20180218.upstream/20180218
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/scripts/debconf.d/0001-preseed-file')
-rwxr-xr-xshare/scripts/debconf.d/0001-preseed-file17
1 files changed, 13 insertions, 4 deletions
diff --git a/share/scripts/debconf.d/0001-preseed-file b/share/scripts/debconf.d/0001-preseed-file
index 5b646c4..fab7d8d 100755
--- a/share/scripts/debconf.d/0001-preseed-file
+++ b/share/scripts/debconf.d/0001-preseed-file
@@ -1,7 +1,7 @@
#!/bin/sh
# container-tools - Manage systemd-nspawn containers
-# Copyright (C) 2014-2017 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+# Copyright (C) 2014-2018 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# SPDX-License-Identifier: GPL-3.0+
#
@@ -38,18 +38,27 @@ then
# available on the system matching the container name
db_set cnt-debconf/preseed-file "${CONFIG}/${NAME}.cfg"
db_fset cnt-debconf/preseed-file seen true
+elif [ "$(ls ${CONFIG}/*/${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/container-tools/debconf
+
+ FILE="$(ls ${CONFIG}/*/${NAME}.cfg)"
+
+ db_set cnt-debconf/preseed-file "${FILE}"
+ db_fset cnt-debconf/preseed-file seen true
elif [ -e "${CONFIG}/default.cfg" ]
then
# user did not specify a pressed file, but there is a default one
db_set cnt-debconf/preseed-file "${CONFIG}/default.cfg"
db_fset cnt-debconf/preseed-file seen true
-elif ls "${CONFIG}"/*.cfg > /dev/null 2>&1
+elif ls "${CONFIG}"/*.cfg > /dev/null 2>&1 || ls "${CONFIG}"/*/*.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 ${CONFIG} && find . -type f -name '*.cfg' -printf '%P\n' | sort)"
- PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "$(basename ${FILE} .cfg), "; done | sed -e 's|, $||')"
+ FILES="$(cd ${CONFIG} && find . -type f -name '*.cfg' -printf '%P\n' | LC_ALL=C sort)"
+ PRESEED_FILES="$(for FILE in ${FILES}; do echo -n "$(echo ${FILE} | sed -e 's|.cfg$||'), "; done | sed -e 's|, $||')"
if [ -n "${PRESEED_FILES}" ]
then