#!/bin/bash
# preinst script for xivocc-installer
#
# see: dh_installdeb(1)

set -e

case "$1" in
    install)
    ;;

    upgrade)
        previous_version=$2
        if dpkg --compare-versions "$previous_version" "<<" "2019.10.00"; then
            check_space
            if (whiptail --title "Stopping XiVO CC Services." --yesno "XiVO CC Services will be stopped. Would you like to continue?" 8 78); then
                xivocc-dcomp stop
            else
                echo "Please re-launch the upgrade when ready."
                exit 100
            fi
        fi
    ;;

    abort-upgrade)
    ;;

    *)
        echo "preinst 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
