diff debian/config @ 359:d1007cf6a49c noffle

[svn] added preliminary debconf backup capability
author godisch
date Fri, 28 Mar 2003 22:17:33 +0000
parents 8f8db12ae359
children a23b37308063
line wrap: on
line diff
--- a/debian/config	Wed Mar 26 16:34:47 2003 +0000
+++ b/debian/config	Fri Mar 28 22:17:33 2003 +0000
@@ -1,7 +1,10 @@
 #!/bin/sh
-# $Id: config 477 2003-03-04 22:16:42Z godisch $
+# $Id: config 497 2003-03-28 22:17:33Z godisch $
 
 set -e
+. /usr/share/debconf/confmodule
+db_version 2.0
+db_capb backup
 
 server_config=/etc/news/noffle.conf
 debian_config=/etc/default/noffle
@@ -16,13 +19,12 @@
 	debian_config=/etc/noffle/conf.debian
 fi
 
-. /usr/share/debconf/confmodule
-db_version 2.0
-
 # are we using debconf?
 db_input high noffle/debconf && db_go || :
-db_get noffle/debconf || RET=""
-[ "$RET" = false ] && exit 0 || :
+db_get noffle/debconf
+if [ "$RET" = false ]; then
+	exit 0
+fi
 
 # read server port value from inetd.conf
 port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | head -n 1 | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || :
@@ -86,14 +88,42 @@
 db_get noffle/fetchmode || RET=""
 [ "$NOFFLE_FETCHMODE" = "$RET" ] || db_fset noffle/fetchmode seen false || :
 
-# input server port, parent server, username, password, fetchmode, maxfetch, default-expire
-db_input low    noffle/port        && db_go || :
-db_input high   noffle/server      && db_go || :
-db_input medium noffle/username    && db_go || :
-db_input medium noffle/password    && db_go || :
-db_input medium noffle/fetchmode   && db_go || :
-db_input medium noffle/maxfetch    && db_go || :
-db_input low noffle/default-expire && db_go || :
+# input configuration using backup capability, see debconf-devel(8)
+state=1
+laststate=7
+while [ "$state" -gt 0 -a "$state" -le "$laststate" ]; do
+	case "$state" in
+	1)
+		db_input low noffle/port || :
+		;;
+	2)
+		db_input high noffle/server || :
+		;;
+	3)
+		db_input medium noffle/username || :
+		;;
+	4)
+		db_get noffle/username
+		if [ "$RET" ]; then
+			db_input medium noffle/password || :
+		fi
+		;;
+	5)
+		db_input medium noffle/fetchmode || :
+		;;
+	6)
+		db_input medium noffle/maxfetch || :
+		;;
+	7)
+		db_input low noffle/default-expire || :
+		;;
+	esac
+	if db_go; then
+		state=$(($state + 1))
+	else
+		state=$(($state - 1))
+	fi
+done
 
 db_stop
 exit 0