Mercurial > noffle
comparison debian/postinst @ 428:011e51924b23 noffle
[svn] updated inetd.conf handling
| author | godisch |
|---|---|
| date | Fri, 20 Jun 2003 18:04:24 +0100 |
| parents | c2fd00030991 |
| children | b415fa4d18ee |
comparison
equal
deleted
inserted
replaced
| 427:14b909051b8d | 428:011e51924b23 |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 # $Id: postinst 568 2003-06-20 16:48:28Z godisch $ | 2 # $Id: postinst 571 2003-06-20 17:04:24Z godisch $ |
| 3 | 3 |
| 4 set -e | 4 set -e |
| 5 | 5 |
| 6 [ "$1" = configure ] || exit 0 | 6 [ "$1" = configure ] || exit 0 |
| 7 | 7 |
| 14 echo "moved to /etc/default/noffle. /etc/noffle and /var/log/noffle are not" | 14 echo "moved to /etc/default/noffle. /etc/noffle and /var/log/noffle are not" |
| 15 echo "used any longer, you may remove them. noffle expiration logs are" | 15 echo "used any longer, you may remove them. noffle expiration logs are" |
| 16 echo "still available through syslog." | 16 echo "still available through syslog." |
| 17 echo | 17 echo |
| 18 sleep 2 | 18 sleep 2 |
| 19 mv -f /etc/noffle/conf /etc/news/noffle.conf || : | 19 mv -fb /etc/noffle/conf /etc/news/noffle.conf || : |
| 20 mv -f /etc/noffle/conf.debian /etc/default/noffle || : | 20 mv -fb /etc/noffle/conf.debian /etc/default/noffle || : |
| 21 mv -f /etc/noffle/conf.old /etc/news/noffle.conf.old 2> /dev/null || : | 21 mv -fb /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 || : | 22 mv -fb /etc/noffle/conf.debian.old /etc/default/noffle.old 2> /dev/null || : |
| 23 rmdir --ignore-fail-on-non-empty /etc/noffle | 23 rmdir --ignore-fail-on-non-empty /etc/noffle |
| 24 fi | 24 fi |
| 25 | 25 |
| 26 if dpkg --compare-versions "$2" eq 1.1.2-1; then | 26 if dpkg --compare-versions "$2" eq 1.1.2-1; then |
| 27 # 1.1.2-1 was in unstable only, don't notify | 27 # 1.1.2-1 was in unstable only, don't notify |
| 28 mv -f /etc/noffle.conf /etc/news/noffle.conf || : | 28 mv -fb /etc/noffle.conf /etc/news/noffle.conf || : |
| 29 mv -f /etc/noffle.conf.old /etc/news/noffle.conf.old 2> /dev/null || : | 29 mv -fb /etc/noffle.conf.old /etc/news/noffle.conf.old 2> /dev/null || : |
| 30 fi | 30 fi |
| 31 | 31 |
| 32 if [ -e /usr/share/debconf/confmodule ]; then | 32 if [ -e /usr/share/debconf/confmodule ]; then |
| 33 . /usr/share/debconf/confmodule | 33 . /usr/share/debconf/confmodule |
| 34 db_version 2.0 | 34 db_version 2.0 |
| 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 | 35 |
| 44 db_get noffle/server | 36 db_get noffle/server |
| 45 server="$RET" | 37 server="$RET" |
| 46 [ "$server" ] || server=news | 38 [ "$server" ] || server=news |
| 47 db_get noffle/username | 39 db_get noffle/username |
| 60 [ "$maxfetch" ] || maxfetch="$maxfetch_default" | 52 [ "$maxfetch" ] || maxfetch="$maxfetch_default" |
| 61 db_get noffle/default-expire | 53 db_get noffle/default-expire |
| 62 defexpire="$RET" | 54 defexpire="$RET" |
| 63 [ "$defexpire" ] || defexpire="$defexpire_default" | 55 [ "$defexpire" ] || defexpire="$defexpire_default" |
| 64 | 56 |
| 65 # /etc/news/noffle.conf may contain sensitive information for NNTP authentication | 57 # /etc/news/noffle.conf may contain sensitive data for NNTP authentication |
| 66 umask 027 | 58 umask 027 |
| 67 cat /usr/share/noffle/noffle.conf | \ | 59 cat /usr/share/noffle/noffle.conf | \ |
| 68 sed "s/^server[[:space:]].*/server $server $username $password/" | \ | 60 sed "s/^server[[:space:]].*/server $server $username $password/" | \ |
| 69 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \ | 61 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \ |
| 70 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \ | 62 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \ |
| 78 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \ | 70 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \ |
| 79 > /etc/default/noffle.new | 71 > /etc/default/noffle.new |
| 80 ucf --three-way /etc/default/noffle.new /etc/default/noffle < /dev/tty | 72 ucf --three-way /etc/default/noffle.new /etc/default/noffle < /dev/tty |
| 81 rm -f /etc/default/noffle.new | 73 rm -f /etc/default/noffle.new |
| 82 | 74 |
| 75 db_get noffle/port | |
| 76 port="$RET" | |
| 77 if [ -z "$port" -o "$port" = 119 ]; then | |
| 78 port=nntp | |
| 79 fi | |
| 80 update-inetd --remove "/usr/bin/noffle -r" | |
| 81 update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | |
| 82 | |
| 83 db_stop | 83 db_stop |
| 84 else | 84 else |
| 85 # no debconf available | |
| 86 ucf --three-way /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty | 85 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 | 86 ucf --three-way /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty |
| 88 if ! grep -q "/usr/bin/noffle -r" /etc/inetd.conf; then | 87 port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || : |
| 89 # just an example, the user needs to activate it himself | 88 if [ "$port" ]; then |
| 90 # update-inetd will silently fail if nntp is already occupied | 89 update-inetd --enable "$port" |
| 90 else | |
| 91 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | 91 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" |
| 92 if grep -q "^nntp.*/usr/bin/noffle -r"; then | |
| 93 update-inetd --disable nntp | |
| 94 fi | |
| 95 echo | |
| 96 echo "You need to active noffle manually in /etc/inetd.conf." | |
| 97 echo | |
| 98 sleep 2 | |
| 99 fi | 92 fi |
| 100 fi | 93 fi |
| 101 | 94 |
| 102 # sanity checks | 95 # sanity checks |
| 103 chown -R news:news /var/lock/noffle /var/spool/noffle | 96 chown -R news:news /var/lock/noffle /var/spool/noffle |
