annotate debian/postinst @ 458:187f5d684589 noffle

[svn] updated standards version
author godisch
date Wed, 09 Jul 2003 18:52:33 +0100
parents 1420216cd450
children fb5e1ef118eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
445
0a5e33528ec1 [svn] removed debug switch
godisch
parents: 444
diff changeset
1 #!/bin/sh
457
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
2 # $Id: postinst 601 2003-06-29 07:22:59Z 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
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
11 if [ -e /usr/share/debconf/confmodule ]; then
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
12 . /usr/share/debconf/confmodule
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
13 db_version 2.0
425
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
14
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
15 db_get noffle/server
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
16 server="$RET"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
17 [ "$server" ] || server=news
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
18 db_get noffle/username
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
19 username="$RET"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
20 db_get noffle/password
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
21 password="$RET"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
22 db_get noffle/fetchmode
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
23 fetchmode="$RET"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
24 [ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
25 fetchmode=ppp
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
26 else
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
27 fetchmode=cron
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
28 fi
425
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
29 db_get noffle/maxfetch
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
30 maxfetch="$RET"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
31 [ "$maxfetch" ] || maxfetch="$maxfetch_default"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
32 db_get noffle/default-expire
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
33 defexpire="$RET"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
34 [ "$defexpire" ] || defexpire="$defexpire_default"
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
35
428
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
36 # /etc/news/noffle.conf may contain sensitive data for NNTP authentication
425
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
37 umask 027
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
38 cat /usr/share/noffle/noffle.conf | \
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
39 sed "s/^server[[:space:]].*/server $server $username $password/" | \
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
40 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
41 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
42 > /etc/news/noffle.conf.new
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
43 chgrp news /etc/news/noffle.conf.new
457
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
44 if cmp -s /etc/news/noffle.conf /etc/news/noffle.conf.new; then
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
45 UCF_FORCE_CONFFNEW=YES ucf /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
46 else
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
47 ucf /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
48 fi
425
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
49 rm -f /etc/news/noffle.conf.new
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
50
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
51 umask 022
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
52 cat /usr/share/noffle/conf.debian | \
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
53 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
54 > /etc/default/noffle.new
457
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
55 if cmp -s /etc/default/noffle /etc/default/noffle.new; then
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
56 UCF_FORCE_CONFFNEW=YES ucf /etc/default/noffle.new /etc/default/noffle < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
57 else
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
58 ucf /etc/default/noffle.new /etc/default/noffle < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
59 fi
425
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
60 rm -f /etc/default/noffle.new
c2fd00030991 [svn] added preliminary ucf support
godisch
parents: 419
diff changeset
61
428
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
62 db_get noffle/port
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
63 port="$RET"
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
64 if [ -z "$port" -o "$port" = 119 ]; then
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
65 port=nntp
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
66 fi
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
67 update-inetd --remove "/usr/bin/noffle -r"
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
68 update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
69
395
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
70 db_stop
056d5fcb7f4b [svn] updated deb'configuration
godisch
parents: 360
diff changeset
71 else
457
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
72 if cmp -s /etc/news/noffle.conf /usr/share/noffle/noffle.conf; then
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
73 UCF_FORCE_CONFFNEW=YES ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
74 else
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
75 ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
76 fi
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
77 if cmp -s /etc/default/noffle /usr/share/noffle/conf.debian; then
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
78 UCF_FORCE_CONFFNEW=YES ucf /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
79 else
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
80 ucf /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty
1420216cd450 [svn] improved ucf transition
godisch
parents: 455
diff changeset
81 fi
443
b415fa4d18ee [svn] update
godisch
parents: 428
diff changeset
82 port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || true
428
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
83 if [ "$port" ]; then
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
84 update-inetd --enable "$port"
011e51924b23 [svn] updated inetd.conf handling
godisch
parents: 425
diff changeset
85 else
416
fbdcd908aa7c [svn] fixed udpate-inetd
godisch
parents: 411
diff changeset
86 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
87 fi
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
88 fi
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
89
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
90 # sanity checks
451
465d6f1971e0 [svn] added sanity check for noffle.conf permissions
godisch
parents: 445
diff changeset
91 chgrp news /etc/news/noffle.conf
465d6f1971e0 [svn] added sanity check for noffle.conf permissions
godisch
parents: 445
diff changeset
92 chmod g+r,o-r /etc/news/noffle.conf
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
93 chown -R news:news /var/lock/noffle /var/spool/noffle
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
94 chmod -R go-w /var/lock/noffle /var/spool/noffle
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
95 find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
96
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
97 # init.d startup
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
98 update-rc.d noffle defaults > /dev/null
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
99 if [ -x /usr/sbin/invoke-rc.d ]; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
100 invoke-rc.d noffle start
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
101 elif [ -x /etc/init.d/noffle ]; then
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
102 /etc/init.d/noffle start
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
103 fi
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
104
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
105 if [ -z "$2" ]; then
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
106 echo
324
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
107 echo "You need to query your parent NNTP server manually for a group overview"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
108 echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for"
5ec39beae9c5 [svn] cleanup
godisch
parents: 301
diff changeset
109 echo "information how to do this."
398
71801bfc07c2 [svn] update for libdgbm3
godisch
parents: 395
diff changeset
110 echo
301
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
111 fi
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
112
3b5b7f3fd71f [svn] initial debian/ upload
godisch
parents:
diff changeset
113 exit 0