#!/bin/sh -e

# source the debconf library
. /usr/share/debconf/confmodule

case "$1" in

  configure)
    # ask this if upgrading to 0.44.0
    if dpkg --compare-versions "$2" lt-nl "0.44.0" ; then
      db_input high nut/remove_debian_conf || true
      db_go
    fi

    # ask this if upgrading to 0.44.1
    if dpkg --compare-versions "$2" lt-nl "0.44.1" ; then
      # manual modification of /etc/nut/upsmon.conf is required
      db_input critical nut/major_conf_changes || true
      db_go
      db_get nut/major_conf_changes
      if [ "$RET" = "false" ] ; then
	exit 1
      fi
    fi

    # ask this if upgrading to 0.44.1-3
    if dpkg --compare-versions "$2" lt-nl "0.44.1-3" ; then
      db_input high nut/change_system_user || true
      db_go
    fi

    # ask this if upgrading to 1.1.11 or later
    if dpkg --compare-versions "$2" lt-nl "1.1.11" ; then
      db_input critical nut/major_upstream_changes || true
      db_go
      db_get nut/major_upstream_changes
      if [ "$RET" = "false" ] ; then
        db_fset nut/major_upstream_changes seen false
      fi
    fi

    # ask this if upgrading to 2.0.0 or later
    if dpkg --compare-versions "$2" lt-nl "2.0.0" ; then
      db_input critical nut/2_0_upstream_changes || true
      db_go
      db_get nut/2_0_upstream_changes
      if [ "$RET" = "false" ] ; then
        db_fset nut/2_0_upstream_changes seen false
      fi
    fi
    ;;

  *)
    ;;

esac



syntax highlighted by Code2HTML, v. 0.9.1