1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/bin/sh
set -e
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/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_get open-infrastructure-container-tools/script
SCRIPT="${RET:-debian}" # string (w/o empty)
db_stop
Install "/var/lib/machines" "${MACHINES}"
Install "/etc/container-tools/config" "${CONFIG}"
Install "/etc/container-tools/debconf" "${DEBCONF}"
Install "/var/cache/container-tools" "${CACHE}"
update-alternatives --quiet --set container-tools_script "/usr/share/container-tools/scripts/${SCRIPT}"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`${1}'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|