#!/bin/bash

set -eux

# We delete the default libvirt network to avoid a possible
# collision with the network on the seed host machine
rm -f /etc/libvirt/qemu/networks/autostart/default.xml
rm -f /etc/libvirt/qemu/networks/default.xml

SCRIPTDIR=$(dirname $0)

if [ -f /etc/sysconfig/libvirtd ]; then
    install -D -g root -o root -m 0755 ${SCRIPTDIR}/default_libvirtd /etc/sysconfig/libvirtd
elif [ -f /etc/default/libvirt-bin ]; then
    install -D -g root -o root -m 0755 ${SCRIPTDIR}/default_libvirt_bin /etc/default/libvirt-bin
else
    echo "Unsupported libvirtd/libvirt-bin configuration."
    exit 1
fi
