annotate debian/config @ 383:863270a06774 noffle

[svn] fixed output
author godisch
date Fri, 18 Apr 2003 20:52:16 +0100
parents 36296f2b60e6
children 056d5fcb7f4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
1 #!/bin/sh
364
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
2 # $Id: config 503 2003-03-29 08:06:12Z godisch $
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
3
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
4 set -e
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
5 . /usr/share/debconf/confmodule
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
6 db_version 2.0
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
7 db_capb backup
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
8
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
9 server_config=/etc/news/noffle.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
10 debian_config=/etc/default/noffle
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
11
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
12 # for backward compatibility = 1.1.2-1, since postinst is not run yet
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
13 if [ ! -e $server_config -a -e /etc/noffle.conf ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
14 server_config=/etc/noffle.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
15 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
16 # for backward compatibility < 1.1.2-1
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
17 if [ ! -e $server_config -a ! -e $debian_config -a -e /etc/noffle/conf ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
18 server_config=/etc/noffle/conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
19 debian_config=/etc/noffle/conf.debian
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
20 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
21
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
22 # are we using debconf?
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
23 db_input high noffle/debconf && db_go || :
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
24 db_get noffle/debconf
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
25 if [ "$RET" = false ]; then
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
26 db_stop
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
27 exit 0
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
28 fi
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
29
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
30 # read server port value from inetd.conf
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
31 port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | head -n 1 | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
32 if [ "$port" ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
33 # read port value from debconf db
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
34 db_get noffle/port
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
35 # for upgrading from < 1.1.2
339
ff1945b26212 [svn] cleanup bugfix
godisch
parents: 333
diff changeset
36 [ "$RET" = 119 ] && RET=nntp || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
37 # we need confirmation, if they differ
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
38 [ "$port" = "$RET" ] || db_fset noffle/port seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
39 # write current port from inetd.conf into debconf db
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
40 [ "$port" = "${port#\#}" ] && db_set noffle/port "$port" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
41 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
42
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
43 # read server, username, password, maxfetch, default-expire from $server_config
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
44 if [ -s "$server_config" ]; then
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
45 db_get noffle/server
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
46 server="`grep '^server' $server_config | head -n 1 | sed 's/^server[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
47 [ "$server" = "$RET" ] || db_fset noffle/server seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
48 [ "$server" ] && db_set noffle/server "$server" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
49
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
50 db_get noffle/username
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
51 server="`grep '^server' $server_config | head -n 1 | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
52 [ "$username" = "$RET" ] || db_fset noffle/username seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
53 [ "$username" ] && db_set noffle/username "$username" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
54
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
55 db_get noffle/password
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
56 server="`grep '^server' $server_config | head -n 1 | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
57 [ "$password" = "$RET" ] || db_fset noffle/password seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
58 [ "$password" ] && db_set noffle/password "$password" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
59
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
60 db_get noffle/maxfetch
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
61 maxfetch="`grep '^max-fetch' $server_config | head -n 1 | sed 's/^max-fetch[[:space:]]*//' 2> /dev/null`" || :
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
62 [ "$maxfetch" = "$RET" ] || db_fset noffle/maxfetch seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
63 [ "$maxfetch" ] && db_set noffle/maxfetch "$maxfetch" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
64
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
65 db_get noffle/default-expire
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
66 defexpire="`grep '^default-expire' $server_config | head -n 1 | sed 's/^default-expire[[:space:]]*//' 2> /dev/null`" || :
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
67 [ "$defexpire" = "$RET" ] || db_fset noffle/defexpire seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
68 [ "$defexpire" ] && db_set noffle/default-expire "$defexpire" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
69 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
70
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
71 # for backward compatibility < 1.1.2-1
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
72 if dpkg --compare-versions "$2" lt-nl 1.1.2; then
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
73 db_get noffle/fetchmode
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
74 case "$RET" in
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
75 'via dialup') db_set noffle/fetchmode ppp;;
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
76 'via permanent connection') db_set noffle/fetchmode cron;;
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
77 esac
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
78 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
79
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
80 # read NOFFLE_FETCHMODE from $debian_config
339
ff1945b26212 [svn] cleanup bugfix
godisch
parents: 333
diff changeset
81 [ -s "$debian_config" ] && . $debian_config || :
341
8f8db12ae359 [svn] minor cleanup
godisch
parents: 339
diff changeset
82 [ "$NOFFLE_FETCHMODE" = ppp -o "$NOFFLE_FETCHMODE" = cron ] || \
8f8db12ae359 [svn] minor cleanup
godisch
parents: 339
diff changeset
83 if [ -x /usr/sbin/pppd ]; then
8f8db12ae359 [svn] minor cleanup
godisch
parents: 339
diff changeset
84 NOFFLE_FETCHMODE=ppp
8f8db12ae359 [svn] minor cleanup
godisch
parents: 339
diff changeset
85 else
8f8db12ae359 [svn] minor cleanup
godisch
parents: 339
diff changeset
86 NOFFLE_FETCHMODE=cron
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
87 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
88 # do we need confirmation?
360
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
89 db_get noffle/fetchmode
a23b37308063 [svn] || true cleanup
godisch
parents: 359
diff changeset
90 [ "$NOFFLE_FETCHMODE" = "$RET" ] || db_fset noffle/fetchmode seen false
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
91
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
92 # input configuration using backup capability, see debconf-devel(8)
362
c036f2b55576 [svn] cleanup
godisch
parents: 361
diff changeset
93 state=1
c036f2b55576 [svn] cleanup
godisch
parents: 361
diff changeset
94 laststate=7
c036f2b55576 [svn] cleanup
godisch
parents: 361
diff changeset
95 while [ "$state" -ge 0 -a "$state" -le "$laststate" ]; do
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
96 case "$state" in
364
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
97 0) db_input high noffle/debconf || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
98 ;;
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
99 1) db_input low noffle/port || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
100 ;;
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
101 2) db_input high noffle/server || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
102 ;;
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
103 3) db_input medium noffle/username || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
104 ;;
363
014146ed83bf [svn] cleanup
godisch
parents: 362
diff changeset
105 4) db_get noffle/username
364
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
106 [ "$RET" ] && db_input medium noffle/password || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
107 ;;
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
108 5) db_input medium noffle/fetchmode || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
109 ;;
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
110 6) db_input medium noffle/maxfetch || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
111 ;;
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
112 7) db_input low noffle/default-expire || :
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
113 ;;
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
114 esac
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
115 if db_go; then
362
c036f2b55576 [svn] cleanup
godisch
parents: 361
diff changeset
116 if [ "$state" -eq 0 ]; then
361
dec92f910289 [svn] improved debconf backup capability
godisch
parents: 360
diff changeset
117 db_get noffle/debconf
362
c036f2b55576 [svn] cleanup
godisch
parents: 361
diff changeset
118 [ "$RET" = true ] || break
361
dec92f910289 [svn] improved debconf backup capability
godisch
parents: 360
diff changeset
119 fi
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
120 state=$(($state + 1))
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
121 else
364
36296f2b60e6 [svn] changed debconf backup
godisch
parents: 363
diff changeset
122 state=0
359
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
123 fi
d1007cf6a49c [svn] added preliminary debconf backup capability
godisch
parents: 341
diff changeset
124 done
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
125
333
47ba9cbc7b75 [svn] added db_stop
godisch
parents: 324
diff changeset
126 db_stop
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
127 exit 0