annotate debian/postinst @ 417:e5153104fbd9 noffle

[svn] typo
author godisch
date Fri, 20 Jun 2003 06:48:04 +0100
parents fbdcd908aa7c
children cb18c7d41cc5
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
417
e5153104fbd9 [svn] typo
godisch
parents: 416
diff changeset
2 # $Id: postinst 560 2003-06-20 05:48:04Z godisch $
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
3
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
4 set -e
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
5
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
6 [ "$1" = configure ] || exit 0
301
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 maxfetch_default=300
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
12 defexpire_default=14
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
13
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
14 if dpkg --compare-versions "$2" lt-nl 1.1.2-1; then
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
15 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
16 echo "/etc/noffle/conf moved to $server_config, /etc/noffle/conf.debian"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
17 echo "moved to $debian_config. /etc/noffle and /var/log/noffle are not"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
18 echo "used any longer, you may remove them. noffle expiration logs are"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
19 echo "still available through syslog."
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
20 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
21 sleep 2
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
22 mv -f /etc/noffle/conf $server_config || :
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
23 mv -f /etc/noffle/conf.debian $debian_config || :
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
24 mv -f /etc/noffle/conf.old $server_config.old 2> /dev/null || :
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
25 mv -f /etc/noffle/conf.debian.old $debian_config.old 2> /dev/null || :
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
26 rmdir --ignore-fail-on-non-empty /etc/noffle
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
27 fi
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
28
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
29 if dpkg --compare-versions "$2" eq 1.1.2-1; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
30 # 1.1.2-1 was in unstable only, don't notify
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
31 mv -f /etc/noffle.conf $server_config || :
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
32 mv -f /etc/noffle.conf.old $server_config.old 2> /dev/null || :
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
33 fi
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
34
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
35 if [ -e /usr/share/debconf/confmodule ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
36 . /usr/share/debconf/confmodule
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
37 db_version 2.0
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
38 db_get noffle/debconf
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
39 if [ "$RET" = true ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
40 db_get noffle/port
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
41 port="$RET"
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
42 if [ -z "$port" -o "$port" = 119 ]; then
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
43 port=nntp
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
44 fi
416
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
45 # maybe disabled only, e.g. dpkg -r noffle
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
46 update-inetd --remove "/usr/bin/noffle -r" || :
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
47 update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
48 db_get noffle/server
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
49 server="$RET"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
50 [ "$server" ] || server=news
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
51 db_get noffle/username
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
52 username="$RET"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
53 db_get noffle/password
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
54 password="$RET"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
55 db_get noffle/fetchmode
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
56 fetchmode="$RET"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
57 [ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
58 fetchmode=ppp
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
59 else
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
60 fetchmode=cron
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
61 fi
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
62 db_get noffle/maxfetch
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
63 maxfetch="$RET"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
64 [ "$maxfetch" ] || maxfetch="$maxfetch_default"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
65 db_get noffle/default-expire
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
66 defexpire="$RET"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
67 [ "$defexpire" ] || defexpire="$defexpire_default"
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
68 # try to be idempotent
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
69 if [ ! -e $server_config.new -a ! -e $debian_config.new ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
70 # make some backup files
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
71 cmp -s $server_config $server_config.old || \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
72 cp -pf $server_config $server_config.old 2> /dev/null || :
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
73 cmp -s $debian_config $debian_config.old || \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
74 cp -pf $debian_config $debian_config.old 2> /dev/null || :
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
75 fi
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
76 # $server_config may contain sensitive information for NNTP authentication
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
77 umask 027
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
78 # we need to use sed instead of Perl to avoid another package dependency
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
79 cat /usr/share/noffle/noffle.conf | \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
80 sed "s/^server[[:space:]].*/server $server $username $password/" | \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
81 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
82 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
83 > $server_config.new
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
84 chgrp news $server_config.new
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
85 umask 022
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
86 cat /usr/share/noffle/conf.debian | \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
87 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
88 > $debian_config.new
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
89 mv -f $server_config.new $server_config
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
90 mv -f $debian_config.new $debian_config
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
91 fi
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
92 db_stop
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
93 else
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
94 # no debconf available
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
95 if [ ! -e $server_config ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
96 umask 027
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
97 cp -f /usr/share/noffle/noffle.conf $server_config.new
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
98 chgrp news $server_config.new
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
99 mv -fb $server_config.new $server_config
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
100 fi
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
101 if [ ! -e $debian_config ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
102 umask 022
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
103 cp -f /usr/share/noffle/conf.debian $debian_config.new
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
104 mv -fb $debian_config.new $debian_config
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
105 fi
416
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
106 if ! grep -q "/usr/bin/noffle -r" /etc/inetd.conf; then
417
e5153104fbd9 [svn] typo
godisch
parents: 416
diff changeset
107 # just an example, the user needs to activate it himself
416
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
108 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
109 update-inetd --disable "$port"
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
110 fi
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
111 fi
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
112
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
113 # sanity checks
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
114 chown -R news:news /var/lock/noffle /var/spool/noffle
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
115 chmod -R go-w /var/lock/noffle /var/spool/noffle
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
116 find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
117
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
118 # init.d startup
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
119 update-rc.d noffle defaults > /dev/null
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
120 if [ -x /usr/sbin/invoke-rc.d ]; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
121 invoke-rc.d noffle start
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
122 elif [ -x /etc/init.d/noffle ]; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
123 /etc/init.d/noffle start
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
124 fi
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
125
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
126 if [ -z "$2" ]; then
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
127 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
128 echo "You need to query your parent NNTP server manually for a group overview"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
129 echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
130 echo "information how to do this."
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
131 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
132 sleep 2
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
133 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
134
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
135 exit 0