postinst is in lxc-utils 3.0.0-0ubuntu2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #!/bin/sh
# postinst script for lxc
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
add_users()
{
if ! getent group lxc-dnsmasq >/dev/null; then
addgroup --quiet --system lxc-dnsmasq
fi
if ! getent passwd lxc-dnsmasq >/dev/null; then
adduser --quiet \
--system \
--ingroup lxc-dnsmasq \
--quiet \
--disabled-login \
--disabled-password \
--home /var/lib/lxc \
--no-create-home \
-gecos "LXC dnsmasq" \
lxc-dnsmasq
fi
}
case "$1" in
configure)
add_users
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_systemd_enable/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'lxc-net.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'lxc-net.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'lxc-net.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'lxc-net.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'lxc.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'lxc.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'lxc.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'lxc.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'lxc-net.service' 'lxc.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/lxc.conf 2.1.0-0ubuntu1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/lxc-instance.conf 2.1.0-0ubuntu1\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/init/lxc-net.conf 2.1.0-0ubuntu1\~ -- "$@"
# End automatically added section
# We need this after the debhelper generated code so that dpkg-maintscript
# can do its renamming first.
if [ "$1" = "configure" ]; then
# The dnsmasq hook has been introduced through SRU into Ubuntu 12.04
# and Ubuntu 12.10.
#
# This means that even though we version-guard the maintscripts entry
# it'll fire multiple times for users doing 12.04 => 12.10 => 13.04
# or even just 12.10 => 13.04.
#
# As there's unfortunately no way to specify per-series base versions
# for maintscripts hooks, we let it fire multiple times and then fix up
# the mess it creates.
#
# This migration code can be removed after Ubuntu 14.04 LTS is released.
if [ -L /etc/dnsmasq.d-available/lxc ] &&
[ "$(readlink /etc/dnsmasq.d-available/lxc)" = "/etc/dnsmasq.d-available/lxc" ] &&
[ -e /etc/dnsmasq.d-available/lxc.dpkg-new ]; then
echo "The dnsmasq configuration has been migrated twice, fixing it."
mv /etc/dnsmasq.d-available/lxc /etc/dnsmasq.d/lxc
mv /etc/dnsmasq.d-available/lxc.dpkg-new /etc/dnsmasq.d-available/lxc
# Try to restart a potential system wide dnsmasq
invoke-rc.d dnsmasq restart 2>/dev/null || true
fi
# Configure dnsmasq
if [ -f /etc/dnsmasq.d-available/lxc ]; then
echo "Setting up lxc dnsmasq configuration."
mkdir -p /etc/dnsmasq.d
if [ ! -e /etc/dnsmasq.d/lxc ]; then
ln -s /etc/dnsmasq.d-available/lxc /etc/dnsmasq.d/lxc
fi
# Try to restart a potential system wide dnsmasq
invoke-rc.d dnsmasq restart 2>/dev/null || true
fi
# Up to version 1.0.0~alpha2-0ubuntu4 lxc was installed world
# readable. After that version if users want it that way for
# convenience, then that's fine. But one time go ahead and
# forcibly change the permissions.
if dpkg --compare-versions "$2" lt "1.0.0~alpha2-0ubuntu5"; then
chmod 700 /var/lib/lxc
chmod 700 /var/cache/lxc
fi
fi
exit 0
|