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.postinst129
1 files changed, 0 insertions, 129 deletions
diff --git a/debian/open-infrastructure-container-tools.postinst b/debian/open-infrastructure-container-tools.postinst
deleted file mode 100755
index f04f12b..0000000
--- a/debian/open-infrastructure-container-tools.postinst
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/bin/sh
-
-set -e
-
-CONFFILE="/etc/open-infrastructure/container.conf"
-
-Install ()
-{
- 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
-
- if ! dpkg-statoverride --list "${DEFAULT}" > /dev/null 2>&1 &&
- ! dpkg-statoverride --list "${TARGET}" > /dev/null 2>&1
- then
- chmod 0700 "${TARGET}"
- chown root:root "${TARGET}"
-
- chmod 0700 "${DEFAULT}"
- chown root:root "${DEFAULT}"
- fi
-}
-
-case "${1}" in
- configure)
- update-alternatives --quiet --install /usr/share/open-infrastructure/container/scripts/default container_script /usr/share/open-infrastructure/container/scripts/curl 1000
- update-alternatives --quiet --install /usr/share/open-infrastructure/container/scripts/default container_script /usr/share/open-infrastructure/container/scripts/mmdebstrap 2000
- update-alternatives --quiet --install /usr/share/open-infrastructure/container/scripts/default container_script /usr/share/open-infrastructure/container/scripts/debootstrap 3000
- update-alternatives --quiet --install /usr/share/open-infrastructure/container/scripts/default container_script /usr/share/open-infrastructure/container/scripts/progress-linux 4000
- update-alternatives --quiet --install /usr/share/open-infrastructure/container/scripts/default container_script /usr/share/open-infrastructure/container/scripts/debian 5000
-
- . /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/hooks
- HOOKS="${RET:-/etc/container-tools/hooks}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/keys
- KEYS="${RET:-/etc/container-tools/keys}" # string (w/o empty)
-
- db_get open-infrastructure-container-tools/cache
- CACHE="${RET:-/var/cache/container-tools}" # string (w/o empty)
-
- 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}"
- Install "/etc/open-infrastructure/container/config" "${CONFIG}"
- Install "/etc/open-infrastructure/container/debconf" "${DEBCONF}"
- Install "/etc/open-infrastructure/container/hooks" "${HOOKS}"
- Install "/etc/open-infrastructure/container/keys" "${KEYS}"
- Install "/var/cache/open-infrastructure/container" "${CACHE}"
-
- update-alternatives --quiet --set container_script "/usr/share/open-infrastructure/container/scripts/${SCRIPT}"
-
- if [ ! -e "${CONFFILE}" ]
- then
-
-cat > "${CONFFILE}" << EOF
-# ${CONFFILE}
-
-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}"
-
- if [ -x /sbin/sysctl ]
- then
- sysctl -q -p /etc/sysctl.d/zz-container.conf
- fi
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
-
- ;;
-
- *)
- echo "postinst called with unknown argument \`${1}'" >&2
- exit 1
- ;;
-esac
-
-#DEBHELPER#
-
-exit 0