comparison debian/config @ 301:3b5b7f3fd71f noffle

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