Mercurial > noffle
annotate debian/postinst @ 457:1420216cd450 noffle
[svn] improved ucf transition
| author | godisch | 
|---|---|
| date | Sun, 29 Jun 2003 08:22:59 +0100 | 
| parents | 57fc18375ad6 | 
| children | fb5e1ef118eb | 
| rev | line source | 
|---|---|
| 445 | 1 #!/bin/sh | 
| 457 | 2 # $Id: postinst 601 2003-06-29 07:22:59Z 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 | |
| 457 | 44 if cmp -s /etc/news/noffle.conf /etc/news/noffle.conf.new; then | 
| 45 UCF_FORCE_CONFFNEW=YES ucf /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty | |
| 46 else | |
| 47 ucf /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty | |
| 48 fi | |
| 425 | 49 rm -f /etc/news/noffle.conf.new | 
| 50 | |
| 51 umask 022 | |
| 52 cat /usr/share/noffle/conf.debian | \ | |
| 53 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \ | |
| 54 > /etc/default/noffle.new | |
| 457 | 55 if cmp -s /etc/default/noffle /etc/default/noffle.new; then | 
| 56 UCF_FORCE_CONFFNEW=YES ucf /etc/default/noffle.new /etc/default/noffle < /dev/tty | |
| 57 else | |
| 58 ucf /etc/default/noffle.new /etc/default/noffle < /dev/tty | |
| 59 fi | |
| 425 | 60 rm -f /etc/default/noffle.new | 
| 61 | |
| 428 | 62 db_get noffle/port | 
| 63 port="$RET" | |
| 64 if [ -z "$port" -o "$port" = 119 ]; then | |
| 65 port=nntp | |
| 66 fi | |
| 67 update-inetd --remove "/usr/bin/noffle -r" | |
| 68 update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | |
| 69 | |
| 395 | 70 db_stop | 
| 71 else | |
| 457 | 72 if cmp -s /etc/news/noffle.conf /usr/share/noffle/noffle.conf; then | 
| 73 UCF_FORCE_CONFFNEW=YES ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty | |
| 74 else | |
| 75 ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty | |
| 76 fi | |
| 77 if cmp -s /etc/default/noffle /usr/share/noffle/conf.debian; then | |
| 78 UCF_FORCE_CONFFNEW=YES ucf /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty | |
| 79 else | |
| 80 ucf /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty | |
| 81 fi | |
| 443 | 82 port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || true | 
| 428 | 83 if [ "$port" ]; then | 
| 84 update-inetd --enable "$port" | |
| 85 else | |
| 416 | 86 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | 
| 87 fi | |
| 324 | 88 fi | 
| 301 | 89 | 
| 324 | 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 | 93 chown -R news:news /var/lock/noffle /var/spool/noffle | 
| 94 chmod -R go-w /var/lock/noffle /var/spool/noffle | |
| 95 find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s | |
| 96 | |
| 97 # init.d startup | |
| 98 update-rc.d noffle defaults > /dev/null | |
| 99 if [ -x /usr/sbin/invoke-rc.d ]; then | |
| 100 invoke-rc.d noffle start | |
| 101 elif [ -x /etc/init.d/noffle ]; then | |
| 102 /etc/init.d/noffle start | |
| 103 fi | |
| 104 | |
| 105 if [ -z "$2" ]; then | |
| 398 | 106 echo | 
| 324 | 107 echo "You need to query your parent NNTP server manually for a group overview" | 
| 108 echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for" | |
| 109 echo "information how to do this." | |
| 398 | 110 echo | 
| 301 | 111 fi | 
| 112 | |
| 113 exit 0 | 
