summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/open-infrastructure-container-tools.config23
-rw-r--r--debian/open-infrastructure-container-tools.postinst45
-rw-r--r--debian/open-infrastructure-container-tools.templates46
3 files changed, 114 insertions, 0 deletions
diff --git a/debian/open-infrastructure-container-tools.config b/debian/open-infrastructure-container-tools.config
new file mode 100644
index 0000000..65d325a
--- /dev/null
+++ b/debian/open-infrastructure-container-tools.config
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+db_settitle open-infrastructure-container-tools/title
+db_input low open-infrastructure-container-tools/machines || true
+db_go
+
+db_settitle open-infrastructure-container-tools/title
+db_input low open-infrastructure-container-tools/config || true
+db_go
+
+db_settitle open-infrastructure-container-tools/title
+db_input low open-infrastructure-container-tools/debconf || true
+db_go
+
+db_settitle open-infrastructure-container-tools/title
+db_input low open-infrastructure-container-tools/cache || true
+db_go
+
+db_stop
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)
diff --git a/debian/open-infrastructure-container-tools.templates b/debian/open-infrastructure-container-tools.templates
new file mode 100644
index 0000000..580467f
--- /dev/null
+++ b/debian/open-infrastructure-container-tools.templates
@@ -0,0 +1,46 @@
+Template: open-infrastructure-container-tools/title
+Type: title
+Description: container-tools: Setup
+
+Template: open-infrastructure-container-tools/machines
+Type: string
+Default: /var/lib/machines
+Description: machines directory:
+ Please specify the directory that will be used to store the
+ containers.
+ .
+ If unsure, use /var/lib/machines (default)
+ or /srv/container when using shared storage.
+
+Template: open-infrastructure-container-tools/config
+Type: string
+Default: /etc/container-tools/config
+Description: config directory:
+ Please specify the directory that will be used to store the
+ container configuration files.
+ .
+ If unsure, use /etc/container-tools/config (default)
+ or /srv/container/container-tools/config when using
+ shared storage.
+
+Template: open-infrastructure-container-tools/debconf
+Type: string
+Default: /etc/container-tools/debconf
+Description: debconf directory:
+ Please specify the directory that will be used to store the
+ container preseed files.
+ .
+ If unsure, use /etc/container-tools/debconf (default)
+ or /srv/container/container-tools/debconf when using
+ shared storage.
+
+Template: open-infrastructure-container-tools/cache
+Type: string
+Default: /var/cache/container-tools
+Description: cache directory:
+ Please specify the directory that will be used to cache
+ files during creation of containers.
+ .
+ If unsure, use /var/cache/container-tools (default) or
+ /srv/container/container-tools/cache when using shared
+ storage.