annotate debian/config @ 302:4f4c233374ca noffle

[svn] removed sed
author godisch
date Sat, 15 Feb 2003 21:34:21 +0000
parents 3b5b7f3fd71f
children 150e75d3c785
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
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
2 # $Id: config 434 2003-02-14 13:54:32Z godisch $
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 . /usr/share/debconf/confmodule
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
6 db_version 2.0
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
7
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
8 server_config=/etc/news/noffle.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
9 debian_config=/etc/default/noffle
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
10
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
11 # for backward compatibility = 1.1.2-1, since postinst is not run yet
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
12 if [ ! -e $server_config -a -e /etc/noffle.conf ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
13 server_config=/etc/noffle.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
14 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
15 # for backward compatibility < 1.1.2-1
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
16 if [ ! -e $server_config -a ! -e $debian_config -a -e /etc/noffle/conf ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
17 server_config=/etc/noffle/conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
18 debian_config=/etc/noffle/conf.debian
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
19 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
20
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
21 # are we using debconf?
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
22 db_input high noffle/debconf && db_go || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
23 db_get noffle/debconf || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
24 [ "$RET" = false ] && exit 0
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
25
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
26 # read server port value from inetd.conf
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
27 port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
28 if [ "$port" ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
29 # read port value from debconf db
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
30 db_get noffle/port || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
31 # for upgrading from < 1.1.2
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
32 [ "$RET" = 119 ] && RET=nntp
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
33 # we need confirmation, if they differ
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
34 [ "$port" = "$RET" ] || db_fset noffle/port seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
35 # write current port from inetd.conf into debconf db
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
36 [ "$port" = "${port#\#}" ] && db_set noffle/port "$port" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
37 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
38
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
39 # read server, username, password, maxfetch, default-expire from $server_config
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
40 if [ -s "$server_config" ]; then
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
41 db_get noffle/server || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
42 server="`grep '^server' $server_config | sed 's/^server[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
43 [ "$server" = "$RET" ] || db_fset noffle/server seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
44 [ "$server" ] && db_set noffle/server "$server" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
45
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
46 db_get noffle/username || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
47 server="`grep '^server' $server_config | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
48 [ "$username" = "$RET" ] || db_fset noffle/username seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
49 [ "$username" ] && db_set noffle/username "$username" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
50
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
51 db_get noffle/password || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
52 server="`grep '^server' $server_config | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
53 [ "$password" = "$RET" ] || db_fset noffle/password seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
54 [ "$password" ] && db_set noffle/password "$password" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
55
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
56 db_get noffle/maxfetch || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
57 maxfetch="`grep '^max-fetch' $server_config | sed 's/^max-fetch[[:space:]]*//' 2> /dev/null`" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
58 [ "$maxfetch" = "$RET" ] || db_fset noffle/maxfetch seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
59 [ "$maxfetch" ] && db_set noffle/maxfetch "$maxfetch" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
60
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
61 db_get noffle/default-expire || RET=""
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
62 defexpire="`grep '^default-expire' $server_config | sed 's/^default-expire[[:space:]]*//' 2> /dev/null`" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
63 [ "$defexpire" = "$RET" ] || db_fset noffle/defexpire seen false || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
64 [ "$defexpire" ] && db_set noffle/default-expire "$defexpire" || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
65 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
66
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
67 # better storing ppp/cron than 'via dialup'/'via permanent connection',
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
68 # since that's less language dependent in the debconf dialog
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 || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
92 db_input medium noffle/username && db_go || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
93 db_input medium noffle/password && db_go || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
94 db_input medium noffle/fetchmode && db_go || :
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
95 db_input medium noffle/maxfetch && db_go || :
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