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