summaryrefslogtreecommitdiffstats
path: root/debian/open-infrastructure-container-tools.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-06-14 19:22:20 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-06-14 19:22:20 +0000
commit34ed2a7257d7500b5ad1af5960f04e172ee7bfe0 (patch)
tree87ee29381d38d842803ca3055fe390dec943f051 /debian/open-infrastructure-container-tools.postinst
parentUpdating vcs fields. (diff)
downloadopen-infrastructure-compute-tools-34ed2a7257d7500b5ad1af5960f04e172ee7bfe0.tar.xz
open-infrastructure-compute-tools-34ed2a7257d7500b5ad1af5960f04e172ee7bfe0.zip
Adding debconf handling for setting choosing /var/lib/machines, /etc/container-tools/config, /etc/container-tools/debconf, and /var/cache/container-tools default locations.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'debian/open-infrastructure-container-tools.postinst')
-rw-r--r--debian/open-infrastructure-container-tools.postinst45
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/open-infrastructure-container-tools.postinst b/debian/open-infrastructure-container-tools.postinst
index 679190e..c0bffcc 100644
--- a/debian/open-infrastructure-container-tools.postinst
+++ b/debian/open-infrastructure-container-tools.postinst
@@ -2,11 +2,56 @@
set -e
+Setup ()
+{
+ DEFAULT="${1}"
+ TARGET="${2}"
+
+ mkdir -p "${DEFAULT}"
+ mkdir -p "${TARGET}"
+
+ if [ "${TARGET}" != "${DEFAULT}" ]
+ then
+ if [ -h "${DEFAULT}" ]
+ then
+ rm -f "${DEFAULT}"
+ ln -s "${TARGET}" "${DEFAULT}"
+ else
+ if [ -e "${DEFAULT}" ] && find "${DEFAULT}" -maxdepth 0 -empty > /dev/null 2>&1
+ then
+ rmdir "${DEFAULT}"
+ ln -s "${TARGET}" "${DEFAULT}"
+ fi
+ fi
+ fi
+}
+
case "${1}" in
configure)
update-alternatives --quiet --install /usr/share/container-tools/scripts/default container-tools_script /usr/share/container-tools/scripts/debootstrap 1000
update-alternatives --quiet --install /usr/share/container-tools/scripts/default container-tools_script /usr/share/container-tools/scripts/debian 3000
update-alternatives --quiet --install /usr/share/container-tools/scripts/default container-tools_script /usr/share/container-tools/scripts/progress-linux 2000
+
+ . /usr/share/debconf/confmodule
+
+ db_get open-infrastructure-container-tools/machines
+ MACHINES="${RET:-/var/lib/machines}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/config
+ CONFIG="${RET:-/etc/container-tools/config}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/debconf
+ DEBCONF="${RET:-/etc/container-tools/debconf}" # string (w/o empty)
+
+ db_get open-infrastructure-container-tools/cache
+ CACHE="${RET:-/var/cache/container-tools}" # string (w/o empty)
+
+ db_stop
+
+ Setup "/var/lib/machines" "${MACHINES}"
+ Setup "/etc/container-tools/config" "${CONFIG}"
+ Setup "/etc/container-tools/debconf" "${DEBCONF}"
+ Setup "/var/cache/container-tools" "${CACHE}"
;;
abort-upgrade|abort-remove|abort-deconfigure)