Mercurial > noffle
comparison debian/postinst @ 459:fb5e1ef118eb noffle
[svn] simplified config file handling using ucf >= 0.17
| author | godisch | 
|---|---|
| date | Mon, 14 Jul 2003 07:56:43 +0100 | 
| parents | 1420216cd450 | 
| children | a5cb498bcbed | 
   comparison
  equal
  deleted
  inserted
  replaced
| 458:187f5d684589 | 459:fb5e1ef118eb | 
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh | 
| 2 # $Id: postinst 601 2003-06-29 07:22:59Z godisch $ | 2 # $Id: postinst 604 2003-07-14 06:56:43Z godisch $ | 
| 3 | 3 | 
| 4 set -e | 4 set -e | 
| 5 | 5 | 
| 6 [ "$1" = configure ] || exit 0 | 6 [ "$1" = configure ] || exit 0 | 
| 7 | 7 | 
| 39 sed "s/^server[[:space:]].*/server $server $username $password/" | \ | 39 sed "s/^server[[:space:]].*/server $server $username $password/" | \ | 
| 40 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \ | 40 sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \ | 
| 41 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \ | 41 sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \ | 
| 42 > /etc/news/noffle.conf.new | 42 > /etc/news/noffle.conf.new | 
| 43 chgrp news /etc/news/noffle.conf.new | 43 chgrp news /etc/news/noffle.conf.new | 
| 44 if cmp -s /etc/news/noffle.conf /etc/news/noffle.conf.new; then | 44 ucf /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty | 
| 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 | |
| 49 rm -f /etc/news/noffle.conf.new | 45 rm -f /etc/news/noffle.conf.new | 
| 50 | 46 | 
| 51 umask 022 | 47 umask 022 | 
| 52 cat /usr/share/noffle/conf.debian | \ | 48 cat /usr/share/noffle/conf.debian | \ | 
| 53 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \ | 49 sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \ | 
| 54 > /etc/default/noffle.new | 50 > /etc/default/noffle.new | 
| 55 if cmp -s /etc/default/noffle /etc/default/noffle.new; then | 51 ucf /etc/default/noffle.new /etc/default/noffle < /dev/tty | 
| 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 | |
| 60 rm -f /etc/default/noffle.new | 52 rm -f /etc/default/noffle.new | 
| 61 | 53 | 
| 62 db_get noffle/port | 54 db_get noffle/port | 
| 63 port="$RET" | 55 port="$RET" | 
| 64 if [ -z "$port" -o "$port" = 119 ]; then | 56 if [ -z "$port" -o "$port" = 119 ]; then | 
| 67 update-inetd --remove "/usr/bin/noffle -r" | 59 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" | 60 update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | 
| 69 | 61 | 
| 70 db_stop | 62 db_stop | 
| 71 else | 63 else | 
| 72 if cmp -s /etc/news/noffle.conf /usr/share/noffle/noffle.conf; then | 64 ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty | 
| 73 UCF_FORCE_CONFFNEW=YES ucf /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty | 65 ucf /usr/share/noffle/conf.debian /etc/default/noffle < /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 | |
| 82 port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || true | 66 port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || true | 
| 83 if [ "$port" ]; then | 67 if [ "$port" ]; then | 
| 84 update-inetd --enable "$port" | 68 update-inetd --enable "$port" | 
| 85 else | 69 else | 
| 86 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | 70 update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r" | 
