#!/bin/sh 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 https://www.debian.org/doc/debian-policy/ or # the debian-policy package create_config_from_template() { local config="$1" local template="$2" local firstver="$3" if [ "$4" != "--" ]; then echo "create_config_from_template called with the wrong number of arguments" >&2 return 1 fi for _ in $(seq 1 4); do shift done if [ -n "$2" ] && dpkg --compare-versions -- "$2" gt "$firstver"; then # The package is already configured, and the version that's been # configured is new enough to contain the config file if [ -e "$config.dpkg-backup" ]; then # The package had been configured in the past and has # subsequently been removed without purging, so a backup of # the config file is still present on the disk. Restore it mv -f "$config.dpkg-backup" "$config" return 0 else # We're doing a regular upgrade. Don't change anything return 0 fi else # We're either installing from scratch, or upgrading from a version # that didn't have the config file yet. Make a copy of the template # in the appropriate location and with the expected permissions install -o root -g root -m 0600 "$template" "$config" return 0 fi } case "$1" in configure) create_config_from_template \ "/etc/libvirt/qemu/networks/default.xml" \ "/usr/share/libvirt/networks/default.xml" \ "6.9.0-2~" \ -- \ "$@" # Trigger daemon restart after installing configuration files dpkg-trigger libvirt-restart-libvirtd ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # Automatically added by dh_installdeb/13.24.2 dpkg-maintscript-helper dir_to_symlink /usr/share/doc/libvirt-daemon-config-network libvirt-common 10.6.0-2\~ -- "$@" # End automatically added section exit 0