comparison 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
comparison
equal deleted inserted replaced
358:9fdcd167f856 359:d1007cf6a49c
1 #!/bin/sh 1 #!/bin/sh
2 # $Id: config 477 2003-03-04 22:16:42Z godisch $ 2 # $Id: config 497 2003-03-28 22:17:33Z godisch $
3 3
4 set -e 4 set -e
5 . /usr/share/debconf/confmodule
6 db_version 2.0
7 db_capb backup
5 8
6 server_config=/etc/news/noffle.conf 9 server_config=/etc/news/noffle.conf
7 debian_config=/etc/default/noffle 10 debian_config=/etc/default/noffle
8 11
9 # for backward compatibility = 1.1.2-1, since postinst is not run yet 12 # for backward compatibility = 1.1.2-1, since postinst is not run yet
14 if [ ! -e $server_config -a ! -e $debian_config -a -e /etc/noffle/conf ]; then 17 if [ ! -e $server_config -a ! -e $debian_config -a -e /etc/noffle/conf ]; then
15 server_config=/etc/noffle/conf 18 server_config=/etc/noffle/conf
16 debian_config=/etc/noffle/conf.debian 19 debian_config=/etc/noffle/conf.debian
17 fi 20 fi
18 21
19 . /usr/share/debconf/confmodule
20 db_version 2.0
21
22 # are we using debconf? 22 # are we using debconf?
23 db_input high noffle/debconf && db_go || : 23 db_input high noffle/debconf && db_go || :
24 db_get noffle/debconf || RET="" 24 db_get noffle/debconf
25 [ "$RET" = false ] && exit 0 || : 25 if [ "$RET" = false ]; then
26 exit 0
27 fi
26 28
27 # read server port value from inetd.conf 29 # read server port value from inetd.conf
28 port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | head -n 1 | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || : 30 port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | head -n 1 | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || :
29 if [ "$port" ]; then 31 if [ "$port" ]; then
30 # read port value from debconf db 32 # read port value from debconf db
84 fi 86 fi
85 # do we need confirmation? 87 # do we need confirmation?
86 db_get noffle/fetchmode || RET="" 88 db_get noffle/fetchmode || RET=""
87 [ "$NOFFLE_FETCHMODE" = "$RET" ] || db_fset noffle/fetchmode seen false || : 89 [ "$NOFFLE_FETCHMODE" = "$RET" ] || db_fset noffle/fetchmode seen false || :
88 90
89 # input server port, parent server, username, password, fetchmode, maxfetch, default-expire 91 # input configuration using backup capability, see debconf-devel(8)
90 db_input low noffle/port && db_go || : 92 state=1
91 db_input high noffle/server && db_go || : 93 laststate=7
92 db_input medium noffle/username && db_go || : 94 while [ "$state" -gt 0 -a "$state" -le "$laststate" ]; do
93 db_input medium noffle/password && db_go || : 95 case "$state" in
94 db_input medium noffle/fetchmode && db_go || : 96 1)
95 db_input medium noffle/maxfetch && db_go || : 97 db_input low noffle/port || :
96 db_input low noffle/default-expire && db_go || : 98 ;;
99 2)
100 db_input high noffle/server || :
101 ;;
102 3)
103 db_input medium noffle/username || :
104 ;;
105 4)
106 db_get noffle/username
107 if [ "$RET" ]; then
108 db_input medium noffle/password || :
109 fi
110 ;;
111 5)
112 db_input medium noffle/fetchmode || :
113 ;;
114 6)
115 db_input medium noffle/maxfetch || :
116 ;;
117 7)
118 db_input low noffle/default-expire || :
119 ;;
120 esac
121 if db_go; then
122 state=$(($state + 1))
123 else
124 state=$(($state - 1))
125 fi
126 done
97 127
98 db_stop 128 db_stop
99 exit 0 129 exit 0