changeset 428:011e51924b23 noffle

[svn] updated inetd.conf handling
author godisch
date Fri, 20 Jun 2003 18:04:24 +0100
parents 14b909051b8d
children f52f39cdc1c2
files debian/postinst
diffstat 1 files changed, 20 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/debian/postinst	Fri Jun 20 17:54:49 2003 +0100
+++ b/debian/postinst	Fri Jun 20 18:04:24 2003 +0100
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: postinst 568 2003-06-20 16:48:28Z godisch $
+# $Id: postinst 571 2003-06-20 17:04:24Z godisch $
 
 set -e
 
@@ -16,31 +16,23 @@
 	echo "still available through syslog."
 	echo
 	sleep 2
-	mv -f /etc/noffle/conf /etc/news/noffle.conf || :
-	mv -f /etc/noffle/conf.debian /etc/default/noffle || :
-	mv -f /etc/noffle/conf.old /etc/news/noffle.conf.old 2> /dev/null || :
-	mv -f /etc/noffle/conf.debian.old /etc/default/noffle.old 2> /dev/null || :
+	mv -fb /etc/noffle/conf /etc/news/noffle.conf || :
+	mv -fb /etc/noffle/conf.debian /etc/default/noffle || :
+	mv -fb /etc/noffle/conf.old /etc/news/noffle.conf.old 2> /dev/null || :
+	mv -fb /etc/noffle/conf.debian.old /etc/default/noffle.old 2> /dev/null || :
 	rmdir --ignore-fail-on-non-empty /etc/noffle
 fi
 
 if dpkg --compare-versions "$2" eq 1.1.2-1; then
 	# 1.1.2-1 was in unstable only, don't notify
-	mv -f /etc/noffle.conf /etc/news/noffle.conf || :
-	mv -f /etc/noffle.conf.old /etc/news/noffle.conf.old 2> /dev/null || :
+	mv -fb /etc/noffle.conf /etc/news/noffle.conf || :
+	mv -fb /etc/noffle.conf.old /etc/news/noffle.conf.old 2> /dev/null || :
 fi
 
 if [ -e /usr/share/debconf/confmodule ]; then
 	. /usr/share/debconf/confmodule
 	db_version 2.0
 
-	db_get noffle/port
-	port="$RET"
-	if [ -z "$port" -o "$port" = 119 ]; then
-		port=nntp
-	fi
-	update-inetd --remove "/usr/bin/noffle -r" || :
-	update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
-
 	db_get noffle/server
 	server="$RET"
 	[ "$server" ] || server=news
@@ -62,7 +54,7 @@
 	defexpire="$RET"
 	[ "$defexpire" ] || defexpire="$defexpire_default"
 
-	# /etc/news/noffle.conf may contain sensitive information for NNTP authentication
+	# /etc/news/noffle.conf may contain sensitive data for NNTP authentication
 	umask 027
 	cat /usr/share/noffle/noffle.conf | \
 		sed "s/^server[[:space:]].*/server $server $username $password/" | \
@@ -80,22 +72,23 @@
 	ucf --three-way /etc/default/noffle.new /etc/default/noffle < /dev/tty
 	rm -f /etc/default/noffle.new
 
+	db_get noffle/port
+	port="$RET"
+	if [ -z "$port" -o "$port" = 119 ]; then
+		port=nntp
+	fi
+	update-inetd --remove "/usr/bin/noffle -r"
+	update-inetd --group MAIL --add "$port\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
+
 	db_stop
 else
-	# no debconf available
 	ucf --three-way /usr/share/noffle/noffle.conf /etc/news/noffle.conf < /dev/tty
 	ucf --three-way /usr/share/noffle/conf.debian /etc/default/noffle < /dev/tty
-	if ! grep -q "/usr/bin/noffle -r" /etc/inetd.conf; then
-		# just an example, the user needs to activate it himself
-		# update-inetd will silently fail if nntp is already occupied
+	port="`grep "/usr/bin/noffle -r" /etc/inetd.conf 2> /dev/null | sed 's/[[:space:]].*$//'`" || :
+	if [ "$port" ]; then
+		update-inetd --enable "$port"
+	else
 		update-inetd --group MAIL --add "nntp\tstream\ttcp\tnowait\tnews\t/usr/sbin/tcpd /usr/bin/noffle -r"
-		if grep -q "^nntp.*/usr/bin/noffle -r"; then
-			update-inetd --disable nntp
-		fi
-		echo
-		echo "You need to active noffle manually in /etc/inetd.conf."
-		echo
-		sleep 2
 	fi
 fi