From 9da9ea63869b9ea7b5834a9e9e45c65fea5c3475 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 18 Feb 2018 15:31:16 +0100 Subject: Making container debconf create script aware of multiple subdirectories below /etc/container-tools/debconf for automatically selecting an existing and matching debconf file. Signed-off-by: Daniel Baumann --- share/scripts/debconf.d/0001-preseed-file | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'share') diff --git a/share/scripts/debconf.d/0001-preseed-file b/share/scripts/debconf.d/0001-preseed-file index 804f328..02dd72d 100755 --- a/share/scripts/debconf.d/0001-preseed-file +++ b/share/scripts/debconf.d/0001-preseed-file @@ -38,6 +38,15 @@ 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 -- cgit v1.2.3