#!/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 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 db_input medium test/teststring || true db_go db_input medium test/testboolean || true db_go db_input medium test/testselect || true db_go db_input medium test/testmultiselect || true db_go db_input medium test/note || true db_go db_input medium test/text || true db_go