changeset 359:d1007cf6a49c noffle

[svn] added preliminary debconf backup capability
author godisch
date Fri, 28 Mar 2003 22:17:33 +0000
parents 9fdcd167f856
children a23b37308063
files debian/changelog debian/config
diffstat 2 files changed, 47 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/debian/changelog	Wed Mar 26 16:34:47 2003 +0000
+++ b/debian/changelog	Fri Mar 28 22:17:33 2003 +0000
@@ -1,14 +1,15 @@
-noffle (1.1.4-4.cvs20030326) unstable; urgency=low
+noffle (1.1.4-4.cvs20030328) unstable; urgency=low
 
   * Updated dependencies, see #185943.
     The netbase option can be removed when #185943 gets closed.
   * Added portuguese debconf translation, closes: #185680.
     Thanks to André Luís Lopes.
   * Updated package description.
+  * Added config script backup capability.
   * Fixed default value for noffle/debconf.
   * Added patch for woody backports.
 
- -- Martin A. Godisch <godisch@debian.org>  Wed, 26 Mar 2003 17:33:20 +0100
+ -- Martin A. Godisch <godisch@debian.org>  Fri, 28 Mar 2003 23:16:39 +0100
 
 noffle (1.0.1-1.1.woody.2) stable; urgency=medium
 
--- 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