summaryrefslogtreecommitdiffstats
path: root/debian/open-infrastructure-container-tools.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/open-infrastructure-container-tools.postinst')
-rwxr-xr-xdebian/open-infrastructure-container-tools.postinst30
1 files changed, 30 insertions, 0 deletions
diff --git a/debian/open-infrastructure-container-tools.postinst b/debian/open-infrastructure-container-tools.postinst
index 3ba287e..4273247 100755
--- a/debian/open-infrastructure-container-tools.postinst
+++ b/debian/open-infrastructure-container-tools.postinst
@@ -2,6 +2,8 @@
set -e
+CONFFILE="/etc/default/container-tools"
+
Install ()
{
DEFAULT="${1}"
@@ -60,6 +62,9 @@ case "${1}" in
db_get open-infrastructure-container-tools/script
SCRIPT="${RET:-debian}" # string (w/o empty)
+ db_get open-infrastructure-container-tools/irc
+ IRK_TARGETS="${RET}" # string (w/ empty)
+
db_stop
Install "/var/lib/machines" "${MACHINES}"
@@ -68,6 +73,31 @@ case "${1}" in
Install "/var/cache/container-tools" "${CACHE}"
update-alternatives --quiet --set container-tools_script "/usr/share/container-tools/scripts/${SCRIPT}"
+
+ if [ ! -e "${CONFFILE}" ]
+ then
+
+cat > "${CONFFILE}" << EOF
+# /etc/default/container-tools
+
+IRK_TARGETS="${IRK_TARGETS}"
+EOF
+
+ fi
+
+ cp -a -f "${CONFFILE}" "${CONFFILE}.tmp"
+
+ # If the admin deleted or commented some variables but then set
+ # them via debconf, (re-)add them to the config file.
+
+ test -z "${IRK_TARGETS}" || \
+ grep -Eq '^ *IRK_TARGETS=' "${CONFFILE}" || \
+ echo "IRK_TARGETS=" >> "${CONFFILE}"
+
+ sed -e "s|^ *IRK_TARGETS=.*|IRK_TARGETS=\"${IRK_TARGETS}\"|" \
+ < "${CONFFILE}" > "${CONFFILE}.tmp"
+
+ mv -f "${CONFFILE}.tmp" "${CONFFILE}"
;;
abort-upgrade|abort-remove|abort-deconfigure)