444
|
1 #!/bin/sh -x
|
|
2 # $Id: postinst 587 2003-06-25 15:58:44Z godisch $
|
301
|
3
|
|
4 set -e
|
324
|
5
|
|
6 [ "$1" = configure ] || exit 0
|
301
|
7
|
|
8 maxfetch_default=300
|
|
9 defexpire_default=14
|
|
10
|
395
|
11 if [ -e /usr/share/debconf/confmodule ]; then
|
|
12 . /usr/share/debconf/confmodule
|
|
13 db_version 2.0
|
425
|
14
|
|
15 db_get noffle/server
|
|
16 server="$RET"
|
|
17 [ "$server" ] || server=news
|
|
18 db_get noffle/username
|
|
19 username="$RET"
|
|
20 db_get noffle/password
|
|
21 password="$RET"
|
|
22 db_get noffle/fetchmode
|
|
23 fetchmode="$RET"
|
|
24 [ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
|
|
25 fetchmode=ppp
|
|
26 else
|
|
27 fetchmode=cron
|
301
|
28 fi
|
425
|
29 db_get noffle/maxfetch
|
|
30 maxfetch="$RET"
|
|
31 [ "$maxfetch" ] || maxfetch="$maxfetch_default"
|
|
32 db_get noffle/default-expire
|
|
33 defexpire="$RET"
|
|
34 [ "$defexpire" ] || defexpire="$defexpire_default"
|
|
35
|
428
|
36 # /etc/news/noffle.conf may contain sensitive data for NNTP authentication
|
425
|
37 umask 027
|
|
38 cat /usr/share/noffle/noffle.conf | \
|
|
39 sed "s/^server[[:space:]].*/server $server $username $password/" | \
|
|
40 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \
|
|
41 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \
|
|
42 > /etc/news/noffle.conf.new
|
|
43 chgrp news /etc/news/noffle.conf.new
|
|
44 ucf --three-way /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty
|
|
45 rm -f /etc/news/noffle.conf.new
|
|
46
|
|
47 umask 022
|
|
48 cat /usr/share/noffle/conf.debian | \
|
|
49 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \
|
|
50 > /etc/default/noffle.new
|
|
51 ucf --three-way /etc/default/noffle.new /etc/default/noffle < /dev/tty
|
|
52 rm -f /etc/default/noffle.new
|
|
53
|
428
|
54 db_get noffle/port
|
|
55 port="$RET"
|
|
56 if [ -z "$port" -o "$port" = 119 ]; then
|
|
57 port=nntp
|
|
58 fi
|
|
59 update-inetd --remove "/usr/bin/noffle -r"
|
|
60 update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
|
|
61
|
395
|
62 db_stop
|
|
63 else
|
425
|
64 ucf --three-way /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty
|
|
65 ucf --three-way /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty
|
443
|
66 port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || true
|
428
|
67 if [ "$port" ]; then
|
|
68 update-inetd --enable "$port"
|
|
69 else
|
416
|
70 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
|
|
71 fi
|
324
|
72 fi
|
301
|
73
|
324
|
74 # sanity checks
|
|
75 chown -R news:news /var/lock/noffle /var/spool/noffle
|
|
76 chmod -R go-w /var/lock/noffle /var/spool/noffle
|
|
77 find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s
|
|
78
|
|
79 # init.d startup
|
|
80 update-rc.d noffle defaults > /dev/null
|
|
81 if [ -x /usr/sbin/invoke-rc.d ]; then
|
|
82 invoke-rc.d noffle start
|
|
83 elif [ -x /etc/init.d/noffle ]; then
|
|
84 /etc/init.d/noffle start
|
|
85 fi
|
|
86
|
|
87 if [ -z "$2" ]; then
|
398
|
88 echo
|
324
|
89 echo "You need to query your parent NNTP server manually for a group overview"
|
|
90 echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for"
|
|
91 echo "information how to do this."
|
398
|
92 echo
|
324
|
93 sleep 2
|
301
|
94 fi
|
|
95
|
|
96 exit 0
|