changeset 425:c2fd00030991 noffle

[svn] added preliminary ucf support
author godisch
date Fri, 20 Jun 2003 17:48:28 +0100
parents afa2ff7b5ebf
children ee231af1b0d8
files debian/changelog debian/config debian/control debian/postinst debian/postrm
diffstat 5 files changed, 74 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/debian/changelog	Fri Jun 20 16:58:53 2003 +0100
+++ b/debian/changelog	Fri Jun 20 17:48:28 2003 +0100
@@ -1,12 +1,12 @@
 noffle (1.1.5-1) unstable; urgency=low
 
   * New upstream release.
-  * Improved debconf question, closes: #198118.
+  * Improved debconf system, added ucf support, closes: #198118.
   * Fixed update-inetd in postinst and prerm.
-  * Added patch to build-dependencies.
+  * Added patch and ucf to (build-)dependencies.
   * Removed lintian override regarding debconf-dependency.
 
- -- Martin A. Godisch <godisch@debian.org>  Fri, 20 Jun 2003 00:32:55 +0200
+ -- Martin A. Godisch <godisch@debian.org>  Fri, 20 Jun 2003 18:48:15 +0200
 
 noffle (1.1.4-8) unstable; urgency=low
 
--- a/debian/config	Fri Jun 20 16:58:53 2003 +0100
+++ b/debian/config	Fri Jun 20 17:48:28 2003 +0100
@@ -1,19 +1,11 @@
 #!/bin/sh
-# $Id: config 567 2003-06-20 15:58:53Z godisch $
+# $Id: config 568 2003-06-20 16:48:28Z godisch $
 
 set -e
 . /usr/share/debconf/confmodule
 db_version 2.0
 db_capb backup
 
-# are we using debconf?
-db_input high noffle/debconf && db_go || :
-db_get noffle/debconf
-if [ "$RET" = false ]; then
-	db_stop
-	exit 0
-fi
-
 # for backward compatibility < 1.1.2-1
 if dpkg --compare-versions "$2" lt-nl 1.1.2; then
 	db_get noffle/fetchmode
@@ -25,11 +17,8 @@
 
 # input configuration using backup capability, see debconf-devel(8)
 state=1
-laststate=7
-while [ "$state" -ge 0 -a "$state" -le "$laststate" ]; do
+while [ "$state" -ge 1 -a "$state" -le 7 ]; do
 	case "$state" in
-	0)	db_input high noffle/debconf || :
-		;;
 	1)	db_input low noffle/port || :
 		;;
 	2)	db_input high noffle/server || :
@@ -47,13 +36,9 @@
 		;;
 	esac
 	if db_go; then
-		if [ "$state" -eq 0 ]; then
-			db_get noffle/debconf
-			[ "$RET" = true ] || break
-		fi
 		state=$(($state + 1))
 	else
-		state=0
+		state=$(($state - 1))
 	fi
 done
 
--- a/debian/control	Fri Jun 20 16:58:53 2003 +0100
+++ b/debian/control	Fri Jun 20 17:48:28 2003 +0100
@@ -7,7 +7,7 @@
 
 Package: noffle
 Architecture: any
-Depends: ${shlibs:Depends}, netbase | openbsd-inetd | inetd-superserver, exim | mail-transport-agent
+Depends: ${shlibs:Depends}, netbase | openbsd-inetd | inetd-superserver, exim | mail-transport-agent, ucf (>= 0.16)
 Recommends: debconf (>= 0.5) | debconf-2.0, sysklogd | system-log-daemon
 Conflicts: debconf (<< 0.5)
 Suggests: slrn | news-reader
--- a/debian/postinst	Fri Jun 20 16:58:53 2003 +0100
+++ b/debian/postinst	Fri Jun 20 17:48:28 2003 +0100
@@ -1,108 +1,90 @@
 #!/bin/sh
-# $Id: postinst 562 2003-06-20 06:05:22Z godisch $
+# $Id: postinst 568 2003-06-20 16:48:28Z godisch $
 
 set -e
 
 [ "$1" = configure ] || exit 0
 
-server_config=/etc/news/noffle.conf
-debian_config=/etc/default/noffle
-
 maxfetch_default=300
 defexpire_default=14
 
 if dpkg --compare-versions "$2" lt-nl 1.1.2-1; then
 	echo
-	echo "/etc/noffle/conf moved to $server_config, /etc/noffle/conf.debian"
-	echo "moved to $debian_config. /etc/noffle and /var/log/noffle are not"
+	echo "/etc/noffle/conf moved to /etc/news/noffle.conf, /etc/noffle/conf.debian"
+	echo "moved to /etc/default/noffle. /etc/noffle and /var/log/noffle are not"
 	echo "used any longer, you may remove them. noffle expiration logs are"
 	echo "still available through syslog."
 	echo
 	sleep 2
-	mv -f /etc/noffle/conf $server_config || :
-	mv -f /etc/noffle/conf.debian $debian_config || :
-	mv -f /etc/noffle/conf.old $server_config.old 2> /dev/null || :
-	mv -f /etc/noffle/conf.debian.old $debian_config.old 2> /dev/null || :
+	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 || :
 	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 $server_config || :
-	mv -f /etc/noffle.conf.old $server_config.old 2> /dev/null || :
+	mv -f /etc/noffle.conf /etc/news/noffle.conf || :
+	mv -f /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/debconf
-	if [ "$RET" = true ]; then
-		db_get noffle/port
-		port="$RET"
-		if [ -z "$port" -o "$port" = 119 ]; then
-			port=nntp
-		fi
-		# maybe disabled only, e.g. dpkg -r noffle
-		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
-		db_get noffle/username
-		username="$RET"
-		db_get noffle/password
-		password="$RET"
-		db_get noffle/fetchmode
-		fetchmode="$RET"
-		[ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
-			fetchmode=ppp
-		else
-			fetchmode=cron
-		fi
-		db_get noffle/maxfetch
-		maxfetch="$RET"
-		[ "$maxfetch" ] || maxfetch="$maxfetch_default"
-		db_get noffle/default-expire
-		defexpire="$RET"
-		[ "$defexpire" ] || defexpire="$defexpire_default"
-		# try to be idempotent
-		if [ ! -e $server_config.new -a ! -e $debian_config.new ]; then
-			# make some backup files
-			cmp -s $server_config $server_config.old || \
-				cp -pf $server_config $server_config.old 2> /dev/null || :
-			cmp -s $debian_config $debian_config.old || \
-				cp -pf $debian_config $debian_config.old 2> /dev/null || :
-		fi
-		# $server_config may contain sensitive information for NNTP authentication
-		umask 027
-		# we need to use sed instead of Perl to avoid another package dependency
-		cat /usr/share/noffle/noffle.conf | \
-			sed "s/^server[[:space:]].*/server $server $username $password/" | \
-			sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \
-			sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \
-			> $server_config.new
-		chgrp news $server_config.new
-		umask 022
-		cat /usr/share/noffle/conf.debian | \
-			sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \
-			> $debian_config.new
-		mv -f $server_config.new $server_config
-		mv -f $debian_config.new $debian_config
+
+	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
+	db_get noffle/username
+	username="$RET"
+	db_get noffle/password
+	password="$RET"
+	db_get noffle/fetchmode
+	fetchmode="$RET"
+	[ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
+		fetchmode=ppp
+	else
+		fetchmode=cron
 	fi
+	db_get noffle/maxfetch
+	maxfetch="$RET"
+	[ "$maxfetch" ] || maxfetch="$maxfetch_default"
+	db_get noffle/default-expire
+	defexpire="$RET"
+	[ "$defexpire" ] || defexpire="$defexpire_default"
+
+	# /etc/news/noffle.conf may contain sensitive information for NNTP authentication
+	umask 027
+	cat /usr/share/noffle/noffle.conf | \
+		sed "s/^server[[:space:]].*/server $server $username $password/" | \
+		sed "s/^max-fetch[[:space:]].*/max-fetch $maxfetch/" | \
+		sed "s/^default-expire[[:space:]].*/default-expire $defexpire/" \
+		> /etc/news/noffle.conf.new
+	chgrp news /etc/news/noffle.conf.new
+	ucf --three-way /etc/news/noffle.conf.new /etc/news/noffle.conf < /dev/tty
+	rm -f /etc/news/noffle.conf.new
+
+	umask 022
+	cat /usr/share/noffle/conf.debian | \
+		sed "s/^NOFFLE_FETCHMODE=.*/NOFFLE_FETCHMODE=$fetchmode/" \
+		> /etc/default/noffle.new
+	ucf --three-way /etc/default/noffle.new /etc/default/noffle < /dev/tty
+	rm -f /etc/default/noffle.new
+
 	db_stop
 else
 	# no debconf available
-	if [ ! -e $server_config ]; then
-		umask 027
-		cp -f /usr/share/noffle/noffle.conf $server_config.new
-		chgrp news $server_config.new
-		mv -fb $server_config.new $server_config
-	fi
-	if [ ! -e $debian_config ]; then
-		umask 022
-		cp -f /usr/share/noffle/conf.debian $debian_config.new
-		mv -fb $debian_config.new $debian_config
-	fi
+	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
@@ -110,6 +92,10 @@
 		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
 
--- a/debian/postrm	Fri Jun 20 16:58:53 2003 +0100
+++ b/debian/postrm	Fri Jun 20 17:48:28 2003 +0100
@@ -1,11 +1,8 @@
 #!/bin/sh
-# $Id: postrm 534 2003-05-24 06:05:53Z godisch $
+# $Id: postrm 568 2003-06-20 16:48:28Z godisch $
 
 set -e
 
-server_config=/etc/news/noffle.conf
-debian_config=/etc/default/noffle
-
 if [ "$1" = remove -o "$1" = purge ]; then
 	rm -f /usr/share/emacs/site-lisp/gnus/noffle.elc
 	rm -rf /var/lock/noffle
@@ -15,13 +12,15 @@
 	update-inetd --remove "/usr/bin/noffle -r"
 	update-rc.d noffle remove > /dev/null
 	rm -f /etc/noffle.conf /etc/noffle.conf.old \
-		$server_config $server_config.old \
-		$debian_config $debian_config.old
+		/etc/news/noffle.conf /etc/news/noffle.conf.old \
+		/etc/default/noffle /etc/default/noffle.old
 	rm -rf /etc/noffle /var/spool/noffle
 	if [ -e /usr/share/debconf/confmodule ]; then
 		. /usr/share/debconf/confmodule
 		db_purge
 	fi
+	ucf --purge /etc/default/noffle < /dev/tty
+	ucf --purge /etc/news/noffle.conf < /dev/tty
 fi
 
 exit 0