diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-12-04 01:46:32 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-12-04 01:49:36 +0000 |
commit | f8f3f4b98091bdfd99d5856c1ec10ee92a33e526 (patch) | |
tree | 434c7dfc68078b2356d60fb16bbfb4b6616332ef /debian/open-infrastructure-container-tools.postinst | |
parent | Adding irker to suggests. (diff) | |
download | open-infrastructure-compute-tools-f8f3f4b98091bdfd99d5856c1ec10ee92a33e526.tar.xz open-infrastructure-compute-tools-f8f3f4b98091bdfd99d5856c1ec10ee92a33e526.zip |
Adding debconf handling for irc notifications.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'debian/open-infrastructure-container-tools.postinst')
-rwxr-xr-x | debian/open-infrastructure-container-tools.postinst | 30 |
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) |