postinst is in lxc 1.0.10-0ubuntu1.1.
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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | #!/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
}
apparmor_load() {
# don't load profiles if mount mediation is not supported
SYSF=/sys/kernel/security/apparmor/features/mount/mask
if [ ! -f $SYSF ]; then
return
fi
if [ -x /lib/init/apparmor-profile-load ]; then
/lib/init/apparmor-profile-load lxc-containers
fi
}
case "$1" in
configure)
add_users
apparmor_load
;;
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_apparmor
if [ "$1" = "configure" ]; then
APP_PROFILE="/etc/apparmor.d/usr.bin.lxc-start"
if [ -f "$APP_PROFILE" ]; then
# Add the local/ include
LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.bin.lxc-start"
test -e "$LOCAL_APP_PROFILE" || {
tmp=`mktemp`
cat <<EOM > "$tmp"
# Site-specific additions and overrides for usr.bin.lxc-start.
# For more details, please see /etc/apparmor.d/local/README.
EOM
mkdir `dirname "$LOCAL_APP_PROFILE"` 2>/dev/null || true
mv -f "$tmp" "$LOCAL_APP_PROFILE"
chmod 644 "$LOCAL_APP_PROFILE"
}
# Reload the profile, including any abstraction updates
if aa-status --enabled 2>/dev/null; then
apparmor_parser -r -T -W "$APP_PROFILE" || true
fi
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/lxc" ] || [ -e "/etc/init/lxc.conf" ]; then
if [ ! -e "/etc/init/lxc.conf" ]; then
update-rc.d lxc defaults >/dev/null
fi
invoke-rc.d lxc start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f lxc remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/lxc-net" ] || [ -e "/etc/init/lxc-net.conf" ]; then
if [ ! -e "/etc/init/lxc-net.conf" ]; then
update-rc.d lxc-net defaults >/dev/null
fi
invoke-rc.d lxc-net start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f lxc-net remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/lxc-instance" ]; then
if [ ! -e "/etc/init/lxc-instance.conf" ]; then
update-rc.d lxc-instance defaults >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f lxc-instance remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/apparmor.d/abstractions/lxc-container-default /etc/apparmor.d/abstractions/lxc/container-base 0.8.0~rc1-4ubuntu18 lxc -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/apparmor.d/abstractions/lxc-start-container /etc/apparmor.d/abstractions/lxc/start-container 0.8.0~rc1-4ubuntu18 lxc -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/dnsmasq.d/lxc /etc/dnsmasq.d-available/lxc 0.8.0~rc1-4ubuntu48 lxc -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/lxc/lxc.conf /etc/lxc/default.conf 0.9.0~alpha2-0ubuntu1+b1~bzr1108-28~ lxc -- "$@"
# 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
|