#!/bin/sh # $1 = action ('configure' or 'reconfigure') # $2 = current-installed-version set -e action="$1" curver="$2" . /usr/share/debconf/confmodule db_version 2.0 db_capb multiselect backup db_title "debconf test: config" if [ -f ./test.dat ]; then # if old configuration file found, read it . ./test.dat db_set test/testselect "$SELECT" db_set test/testmultiselect "$MULTISELECT" fi if [ "$action" = "configure" ] && \ dpkg --compare-versions "$curver" lt 2; then # change configuration at version 2. # need reconfigure by user # XXX: or use flag on test/teststring? if ! db_get test/teststring_old; then # old not found, so it is first try of config db_register test/teststring test/teststring_old db_set test/teststring_old "$STRING" db_reset test/teststring fi # otherwise, it is 2nd try from postinst # not need to set/reset teststring, use debconf var instead if ! db_get test/testboolean_old; then # same as string db_register test/testboolean test/testboolean_old db_set test/testboolean_old "$BOOLEAN" db_reset test/testboolean fi # otherwise, it is 2nd try from postinst # not need to set/reset testboolean, use debconf ver instead else # normal upgrade case, use configuration files data if [ -f ./test.dat ]; then # already source STRING, BOOLEAN db_set test/teststring "$STRING" db_set test/testboolean "$BOOLEAN" fi fi STEP="1" while [ "$STEP" != "0" ] && [ "$STEP" != "7" ] do case "$STEP" in 1) db_input medium test/testboolean || true ;; 2) db_input medium test/teststring || true ;; 3) db_input medium test/testselect || true ;; 4) db_input medium test/testmultiselect || true ;; 5) db_input medium test/note || true ;; 6) db_input medium test/text || true ;; esac if db_go; then STEP=$(($STEP + 1)) else STEP=$(($STEP - 1)) fi done