postinst is in lxc1 2.0.7-0ubuntu1~16.04.2.
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 | #!/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
# 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
# End automatically added section
# Automatically added by dh_systemd_enable
# 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
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/lxc-net" ]; then
update-rc.d lxc-net defaults >/dev/null
fi
if [ -x "/etc/init.d/lxc-net" ] || [ -e "/etc/init/lxc-net.conf" ]; then
invoke-rc.d lxc-net start || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/lxc-instance" ]; then
update-rc.d lxc-instance defaults >/dev/null || exit $?
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start lxc-net.service lxc.service >/dev/null || true
fi
# 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
|