annotate debian/postinst @ 412:3698f482a940 noffle

[svn] updated to 1.1.5-1
author godisch
date Thu, 19 Jun 2003 23:30:50 +0100
parents b9018588cc52
children fbdcd908aa7c
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
411
b9018588cc52 [svn] fixed update-inetd
godisch
parents: 398
diff changeset
2 # $Id: postinst 554 2003-06-19 22:25:30Z 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
411
b9018588cc52 [svn] fixed update-inetd
godisch
parents: 398
diff changeset
35 # maybe disabled only, e.g. dpkg -r noffle
b9018588cc52 [svn] fixed update-inetd
godisch
parents: 398
diff changeset
36 update-inetd --remove "/usr/bin/noffle -r" || :
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
37 if [ -e /usr/share/debconf/confmodule ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
38 . /usr/share/debconf/confmodule
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
39 db_version 2.0
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
40 db_get noffle/debconf
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
41 if [ "$RET" = true ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
42 db_get noffle/port
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
43 port="$RET"
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
44 if [ -z "$port" -o "$port" = 119 ]; then
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
45 port=nntp
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
46 fi
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
411
b9018588cc52 [svn] fixed update-inetd
godisch
parents: 398
diff changeset
106 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
107 fi
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
108
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
109 # sanity checks
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
110 chown -R news:news /var/lock/noffle /var/spool/noffle
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
111 chmod -R go-w /var/lock/noffle /var/spool/noffle
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
112 find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
113
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
114 # init.d startup
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
115 update-rc.d noffle defaults > /dev/null
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
116 if [ -x /usr/sbin/invoke-rc.d ]; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
117 invoke-rc.d noffle start
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
118 elif [ -x /etc/init.d/noffle ]; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
119 /etc/init.d/noffle start
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
120 fi
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
121
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
122 if [ -z "$2" ]; then
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
123 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
124 echo "You need to query your parent NNTP server manually for a group overview"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
125 echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
126 echo "information how to do this."
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
127 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
128 sleep 2
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
129 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
130
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
131 exit 0