#!/bin/sh # postinst script for libvirt-bin # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in configure) 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 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 # 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 ;; 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. #DEBHELPER# exit 0