Mercurial > noffle
annotate debian/postinst @ 464:d9035d08fe51 noffle
[svn] * src/fetch.c: Log failed posting that we can't mail back to the sender
or where sending fails to <Noffle spool>/failed.posting.
author | bears |
---|---|
date | Wed, 23 Jul 2003 10:32:25 +0100 |
parents | fb5e1ef118eb |
children | a5cb498bcbed |
rev | line source |
---|---|
445 | 1 #!/bin/sh |
459
fb5e1ef118eb
[svn] simplified config file handling using ucf >= 0.17
godisch
parents:
457
diff
changeset
|
2 # $Id: postinst 604 2003-07-14 06:56:43Z 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 | |
459
fb5e1ef118eb
[svn] simplified config file handling using ucf >= 0.17
godisch
parents:
457
diff
changeset
|
44 ucf /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty |
425 | 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 | |
459
fb5e1ef118eb
[svn] simplified config file handling using ucf >= 0.17
godisch
parents:
457
diff
changeset
|
51 ucf /etc/default/noffle.new /etc/default/noffle < /dev/tty |
425 | 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 | |
459
fb5e1ef118eb
[svn] simplified config file handling using ucf >= 0.17
godisch
parents:
457
diff
changeset
|
64 ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty |
fb5e1ef118eb
[svn] simplified config file handling using ucf >= 0.17
godisch
parents:
457
diff
changeset
|
65 ucf /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 |
451
465d6f1971e0
[svn] added sanity check for noffle.conf permissions
godisch
parents:
445
diff
changeset
|
75 chgrp news /etc/news/noffle.conf |
465d6f1971e0
[svn] added sanity check for noffle.conf permissions
godisch
parents:
445
diff
changeset
|
76 chmod g+r,o-r /etc/news/noffle.conf |
324 | 77 chown -R news:news /var/lock/noffle /var/spool/noffle |
78 chmod -R go-w /var/lock/noffle /var/spool/noffle | |
79 find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s | |
80 | |
81 # init.d startup | |
82 update-rc.d noffle defaults > /dev/null | |
83 if [ -x /usr/sbin/invoke-rc.d ]; then | |
84 invoke-rc.d noffle start | |
85 elif [ -x /etc/init.d/noffle ]; then | |
86 /etc/init.d/noffle start | |
87 fi | |
88 | |
89 if [ -z "$2" ]; then | |
398 | 90 echo |
324 | 91 echo "You need to query your parent NNTP server manually for a group overview" |
92 echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for" | |
93 echo "information how to do this." | |
398 | 94 echo |
301 | 95 fi |
96 | |
97 exit 0 |