annotate debian/postinst @ 425:c2fd00030991 noffle

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