annotate debian/config @ 324:5ec39beae9c5 noffle

[svn] cleanup
author godisch
date Sat, 22 Feb 2003 21:54:34 +0000
parents 150e75d3c785
children 47ba9cbc7b75
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
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
2 # $Id: config 459 2003-02-22 21:54:34Z godisch $
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
3
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
4 set -e
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
5
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
6 server_config=/etc/news/noffle.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
7 debian_config=/etc/default/noffle
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
8
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
9 # for backward compatibility = 1.1.2-1, since postinst is not run yet
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
10 if [ ! -e $server_config -a -e /etc/noffle.conf ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
11 server_config=/etc/noffle.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
12 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
13 # for backward compatibility < 1.1.2-1
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
14 if [ ! -e $server_config -a ! -e $debian_config -a -e /etc/noffle/conf ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
15 server_config=/etc/noffle/conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
16 debian_config=/etc/noffle/conf.debian
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
17 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
18
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
19 . /usr/share/debconf/confmodule
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
20 db_version 2.0
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
21
301
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 || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
24 db_get noffle/debconf || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
25 [ "$RET" = false ] && exit 0
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
26
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
27 # read server port value from inetd.conf
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
28 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
29 if [ "$port" ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
30 # read port value from debconf db
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
31 db_get noffle/port || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
32 # for upgrading from < 1.1.2
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
33 [ "$RET" = 119 ] && RET=nntp
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
34 # we need confirmation, if they differ
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
35 [ "$port" = "$RET" ] || db_fset noffle/port seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
36 # write current port from inetd.conf into debconf db
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
37 [ "$port" = "${port#\#}" ] && db_set noffle/port "$port" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
38 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
39
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
40 # read server, username, password, maxfetch, default-expire from $server_config
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
41 if [ -s "$server_config" ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
42 db_get noffle/server || RET=""
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
43 server="`grep '^server' $server_config | head -n 1 | sed 's/^server[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
44 [ "$server" = "$RET" ] || db_fset noffle/server seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
45 [ "$server" ] && db_set noffle/server "$server" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
46
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
47 db_get noffle/username || RET=""
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
48 server="`grep '^server' $server_config | head -n 1 | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
49 [ "$username" = "$RET" ] || db_fset noffle/username seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
50 [ "$username" ] && db_set noffle/username "$username" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
51
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
52 db_get noffle/password || RET=""
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
53 server="`grep '^server' $server_config | head -n 1 | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
54 [ "$password" = "$RET" ] || db_fset noffle/password seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
55 [ "$password" ] && db_set noffle/password "$password" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
56
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
57 db_get noffle/maxfetch || RET=""
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
58 maxfetch="`grep '^max-fetch' $server_config | head -n 1 | sed 's/^max-fetch[[:space:]]*//' 2> /dev/null`" || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
59 [ "$maxfetch" = "$RET" ] || db_fset noffle/maxfetch seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
60 [ "$maxfetch" ] && db_set noffle/maxfetch "$maxfetch" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
61
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
62 db_get noffle/default-expire || RET=""
310
150e75d3c785 [svn] fixed config for in case of multiple servers
godisch
parents: 301
diff changeset
63 defexpire="`grep '^default-expire' $server_config | head -n 1 | sed 's/^default-expire[[:space:]]*//' 2> /dev/null`" || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
64 [ "$defexpire" = "$RET" ] || db_fset noffle/defexpire seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
65 [ "$defexpire" ] && db_set noffle/default-expire "$defexpire" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
66 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
67
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
68 # for backward compatibility < 1.1.2-1
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
69 if dpkg --compare-versions "$2" lt-nl 1.1.2; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
70 db_get noffle/fetchmode || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
71 case "$RET" in
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
72 'via dialup') db_set noffle/fetchmode ppp || :;;
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
73 'via permanent connection') db_set noffle/fetchmode cron || :;;
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
74 esac
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
75 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
76
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
77 # read NOFFLE_FETCHMODE from $debian_config
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
78 [ -s "$debian_config" ] && . $debian_config
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
79 [ "$NOFFLE_FETCHMODE" != ppp -a "$NOFFLE_FETCHMODE" != cron ] && \
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
80 if [ -x /usr/sbin/pppd ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
81 NOFFLE_FETCHMODE=ppp
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
82 else
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
83 NOFFLE_FETCHMODE=cron
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
84 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
85 # do we need confirmation?
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
86 db_get noffle/fetchmode || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
87 [ "$NOFFLE_FETCHMODE" = "$RET" ] || db_fset noffle/fetchmode seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
88
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
89 # input server port, parent server, username, password, fetchmode, maxfetch, default-expire
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
90 db_input low noffle/port && db_go || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
91 db_input high noffle/server && db_go || :
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
92 db_input medium noffle/username && db_go || :
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
93 db_input medium noffle/password && db_go || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
94 db_input medium noffle/fetchmode && db_go || :
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 310
diff changeset
95 db_input medium noffle/maxfetch && db_go || :
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
96 db_input low noffle/default-expire && db_go || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
97
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
98 exit 0