postinst is in libvirt-bin 0.9.12.3-1+deb7u1.
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 | #!/bin/sh
# postinst script for libvirt-bin
#
# 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_groups()
{
if ! getent group libvirt >/dev/null; then
addgroup --system libvirt
fi
# user and group libvirt runs qemu/kvm instances with
if ! getent group kvm >/dev/null; then
addgroup --quiet --system kvm
fi
if ! getent group libvirt-qemu >/dev/null; then
addgroup --quiet --system libvirt-qemu
fi
if ! getent passwd libvirt-qemu >/dev/null; then
adduser --quiet \
--system \
--ingroup kvm \
--quiet \
--disabled-login \
--disabled-password \
--home /var/lib/libvirt \
--no-create-home \
-gecos "Libvirt Qemu" \
libvirt-qemu
fi
adduser libvirt-qemu libvirt-qemu
}
add_statoverrides()
{
ROOT_DIRS="\
/var/lib/libvirt/images/ \
/var/lib/libvirt/boot/ \
/var/cache/libvirt/ \
"
QEMU_DIRS="\
/var/lib/libvirt/qemu/ \
/var/cache/libvirt/qemu/ \
"
SANLOCK_DIR="/var/lib/libvirt/sanlock"
QEMU_CONF="/etc/libvirt/qemu.conf"
for dir in ${ROOT_DIRS}; do
if ! dpkg-statoverride --list "${dir}" >/dev/null 2>&1; then
[ ! -e "${dir}" ] || chown root:root "${dir}"
[ ! -e "${dir}" ] || chmod 0711 "${dir}"
fi
done
for dir in ${QEMU_DIRS}; do
if ! dpkg-statoverride --list "${dir}" >/dev/null 2>&1; then
[ ! -e "${dir}" ] || chown libvirt-qemu:kvm "${dir}"
[ ! -e "${dir}" ] || chmod 0750 "${dir}"
fi
done
if ! dpkg-statoverride --list "${SANLOCK_DIR}" >/dev/null 2>&1; then
[ ! -e "${SANLOCK_DIR}" ] || chown root:root "${SANLOCK_DIR}"
[ ! -e "${SANLOCK_DIR}" ] || chmod 0700 "${SANLOCK_DIR}"
fi
if ! dpkg-statoverride --list "${QEMU_CONF}" >/dev/null 2>&1; then
[ ! -e "${QEMU_CONF}" ] || chown root:root "${QEMU_CONF}"
[ ! -e "${QEMU_CONF}" ] || chmod 0600 "${QEMU_CONF}"
fi
}
case "$1" in
configure)
add_users_groups
add_statoverrides
# libvirt from 0.6.0 on is safe to restart with running vms:
if [ -n "$2" ] && dpkg --compare-versions "$2" ge 0.6.0; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d libvirt-bin stop
else
/etc/init.d/libvirt-bin stop
fi
sleep 1
fi
if dpkg --compare-versions "$2" lt "0.6.1-2"; then
if [ -e /etc/rc2.d/S20libvirt-bin ] && \
[ -e /etc/rc3.d/S20libvirt-bin ] && \
[ -e /etc/rc4.d/S20libvirt-bin ] && \
[ -e /etc/rc5.d/S20libvirt-bin ] && \
[ -e /etc/rc0.d/K20libvirt-bin ] && \
[ -e /etc/rc1.d/K20libvirt-bin ] && \
[ -e /etc/rc6.d/K20libvirt-bin ]; then
update-rc.d -f libvirt-bin remove >/dev/null
fi
fi
# Make sure the directories don't get removed on package removal since
# logrotate chokes otherwise.
for dir in qemu uml lxc; do
touch /var/log/libvirt/"${dir}"/.placeholder
done
;;
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_installinit
if [ -x "/etc/init.d/libvirt-bin" ]; then
update-rc.d libvirt-bin defaults 28 72 >/dev/null
invoke-rc.d libvirt-bin start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/libvirt-guests" ]; then
update-rc.d libvirt-guests defaults 29 71 >/dev/null
invoke-rc.d libvirt-guests start || exit $?
fi
# End automatically added section
exit 0
|