#! /bin/sh

set -e

if [ "$1" = configure ] ; then
    # Add the kvm group unless it's already there
    if ! getent group kvm >/dev/null; then
        addgroup --quiet --system kvm || true
    fi

    if [ -x /usr/sbin/update-alternatives ]; then
        # Install alternatives for all qemu-system binaries.  Set i386 as highest
        # priority, as it has been the default qemu for quite some time.
        update-alternatives --install /usr/bin/qemu qemu \
            /usr/bin/qemu-system-i386 20
        arches="arm cris m68k microblaze mips mips64 mips64el mipsel ppc ppc64 ppcemb s390x sh4 sh4eb sparc sparc64 x86_64"
        for arch in $arches ; do
            update-alternatives --install /usr/bin/qemu qemu \
                /usr/bin/qemu-system-"$arch" 10
        done
    fi
fi

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
