changeset 324:5ec39beae9c5 noffle

[svn] cleanup
author godisch
date Sat, 22 Feb 2003 21:54:34 +0000
parents 67ce1ddf7313
children c36eb2596531
files debian/config debian/postinst debian/postrm debian/preinst debian/prerm
diffstat 5 files changed, 137 insertions(+), 154 deletions(-) [+]
line wrap: on
line diff
--- a/debian/config	Sat Feb 22 21:09:23 2003 +0000
+++ b/debian/config	Sat Feb 22 21:54:34 2003 +0000
@@ -1,9 +1,7 @@
 #!/bin/sh
-# $Id: config 444 2003-02-19 07:36:16Z godisch $
+# $Id: config 459 2003-02-22 21:54:34Z godisch $
 
 set -e
-. /usr/share/debconf/confmodule
-db_version 2.0
 
 server_config=/etc/news/noffle.conf
 debian_config=/etc/default/noffle
@@ -18,6 +16,9 @@
 	debian_config=/etc/noffle/conf.debian
 fi
 
+. /usr/share/debconf/confmodule
+db_version 2.0
+
 # are we using debconf?
 db_input high noffle/debconf && db_go || :
 db_get noffle/debconf || RET=""
@@ -64,8 +65,7 @@
 	[ "$defexpire" ] && db_set noffle/default-expire "$defexpire" || :
 fi
 
-# better storing ppp/cron than 'via dialup'/'via permanent connection',
-# since that's less language dependent in the debconf dialog
+# for backward compatibility < 1.1.2-1
 if dpkg --compare-versions "$2" lt-nl 1.1.2; then
 	db_get noffle/fetchmode || RET=""
 	case "$RET" in
@@ -89,10 +89,10 @@
 # input server port, parent server, username, password, fetchmode, maxfetch, default-expire
 db_input low noffle/port && db_go || :
 db_input high noffle/server && db_go || :
-db_input medium noffle/username && db_go || :
-db_input medium noffle/password && db_go || :
+db_input medium noffle/username  && db_go || :
+db_input medium noffle/password  && db_go || :
 db_input medium noffle/fetchmode && db_go || :
-db_input medium noffle/maxfetch && db_go || :
+db_input medium noffle/maxfetch  && db_go || :
 db_input low noffle/default-expire && db_go || :
 
 exit 0
--- a/debian/postinst	Sat Feb 22 21:09:23 2003 +0000
+++ b/debian/postinst	Sat Feb 22 21:54:34 2003 +0000
@@ -1,9 +1,9 @@
 #!/bin/sh
-# $Id: postinst 434 2003-02-14 13:54:32Z godisch $
+# $Id: postinst 459 2003-02-22 21:54:34Z godisch $
 
 set -e
-. /usr/share/debconf/confmodule
-db_version 2.0
+
+[ "$1" = configure ] || exit 0
 
 server_config=/etc/news/noffle.conf
 debian_config=/etc/default/noffle
@@ -11,104 +11,104 @@
 maxfetch_default=300
 defexpire_default=14
 
-case "$1" in
-configure)
-	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 "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 || :
-		rmdir /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 || :
+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 "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 || :
+	rmdir /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 || :
+fi
+
+. /usr/share/debconf/confmodule
+db_version 2.0
+
+db_get noffle/debconf || RET=""
+if [ "$RET" != false ]; then
+	db_get noffle/port || RET=""
+	port="$RET"
+	[ -z "$port" -o "$port" = 119 ] && port=nntp
+	# 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 || RET=""
+	server="$RET"
+	[ "$server" ] || server=news
+	db_get noffle/username || RET=""
+	username="$RET"
+	db_get noffle/password || RET=""
+	password="$RET"
+	db_get noffle/fetchmode || RET=""
+	fetchmode="$RET"
+	[ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
+		fetchmode=ppp
+	else
+		fetchmode=cron
 	fi
-	# if we are allowed to overwrite $server_config and $debian_config...
-	db_get noffle/debconf || RET=""
-	if [ "$RET" != false ]; then
-		db_get noffle/port || RET=""
-		port="$RET"
-		[ -z "$port" -o "$port" = 119 ] && port=nntp
-		# 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 || RET=""
-		server="$RET"
-		[ "$server" ] || server=news
-		db_get noffle/username || RET=""
-		username="$RET"
-		db_get noffle/password || RET=""
-		password="$RET"
-		db_get noffle/fetchmode || RET=""
-		fetchmode="$RET"
-		[ "$fetchmode" ] || if [ -x /usr/sbin/pppd ]; then
-			fetchmode=ppp
-		else
-			fetchmode=cron
-		fi
-		db_get noffle/maxfetch || RET=""
-		maxfetch="$RET"
-		[ "$maxfetch" ] || maxfetch="$maxfetch_default"
-		db_get noffle/default-expire || RET=""
-		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/maxfetch || RET=""
+	maxfetch="$RET"
+	[ "$maxfetch" ] || maxfetch="$maxfetch_default"
+	db_get noffle/default-expire || RET=""
+	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
-	# sanity checks
-	chown -R news:news /var/lock/noffle /var/spool/noffle
-	chmod -R go-w /var/lock/noffle /var/spool/noffle
-	find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s
-	if [ -z "$2" ]; then
-		echo ""
-		echo "You need to query your parent NNTP server manually for a group overview"
-		echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for"
-		echo "information how to do this."
-		echo ""
-		sleep 2
-	fi
-	;;
-abort-upgrade|abort-remove|abort-deconfigure)
-	;;
-*)
-	echo "postinst called with unknown argument '$1'" >&2
-	exit 1
-	;;
-esac
+	# $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
+fi
+db_stop
 
-if [ -x /etc/init.d/noffle ]; then
-	update-rc.d noffle defaults > /dev/null
-	invoke-rc.d noffle start || :
+# sanity checks
+chown -R news:news /var/lock/noffle /var/spool/noffle
+chmod -R go-w      /var/lock/noffle /var/spool/noffle
+find /var/lock/noffle /var/spool/noffle -type d -print0 | xargs -0 chmod g+s
+
+# init.d startup
+update-rc.d noffle defaults > /dev/null
+if [ -x /usr/sbin/invoke-rc.d ]; then
+	invoke-rc.d noffle start
+elif [ -x /etc/init.d/noffle ]; then
+	/etc/init.d/noffle start
+fi
+
+if [ -z "$2" ]; then
+	echo ""
+	echo "You need to query your parent NNTP server manually for a group overview"
+	echo "and descriptions. Have a look at /usr/share/doc/noffle/README.Debian for"
+	echo "information how to do this."
+	echo ""
+	sleep 2
 fi
 
 exit 0
--- a/debian/postrm	Sat Feb 22 21:09:23 2003 +0000
+++ b/debian/postrm	Sat Feb 22 21:54:34 2003 +0000
@@ -1,34 +1,28 @@
 #!/bin/sh
-# $Id: postrm 451 2003-02-20 10:57:54Z godisch $
+# $Id: postrm 459 2003-02-22 21:54:34Z godisch $
 
 set -e
-. /usr/share/debconf/confmodule
-db_version 2.0
 
 server_config=/etc/news/noffle.conf
 debian_config=/etc/default/noffle
 
-case "$1" in
-remove)
+if [ "$1" = remove -o "$1" = purge ]; then
 	rm -f /usr/share/emacs/site-lisp/gnus/noffle.elc
 	rm -rf /var/lock/noffle
-	;;
-purge)
+fi
+
+if [ "$1" = purge ]; then
 	update-inetd --remove "/usr/bin/noffle -r"
 	update-rc.d noffle remove > /dev/null
-	rm -f /usr/share/emacs/site-lisp/gnus/noffle.elc \
+	rm -f /etc/noffle.conf /etc/noffle.conf.old \
 		$server_config $server_config.old \
-		$debian_config $debian_config.old \
-		/etc/noffle.conf /etc/noffle.conf.old
-	rm -rf /etc/noffle /var/spool/noffle /var/lock/noffle
-	db_purge
-	;;
-upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-	;;
-*)
-	echo "postrm called with unknown argument '$1'" >&2
-	exit 1
-	;;
-esac
+		$debian_config $debian_config.old
+	rm -rf /etc/noffle /var/spool/noffle
+	if [ -e /usr/share/debconf/confmodule ]; then
+		. /usr/share/debconf/confmodule
+		db_purge
+		db_stop
+	fi
+fi
 
 exit 0
--- a/debian/preinst	Sat Feb 22 21:09:23 2003 +0000
+++ b/debian/preinst	Sat Feb 22 21:54:34 2003 +0000
@@ -1,10 +1,9 @@
 #!/bin/sh
-# $Id: preinst 446 2003-02-19 19:06:45Z godisch $
+# $Id: preinst 459 2003-02-22 21:54:34Z godisch $
 
 set -e
 
-case "$1" in
-install|upgrade)
+if [ "$1" = install -o "$1" = upgrade ]; then
 	# this directory may still exist because of old lock files,
 	# make sure the symlink can be installed
 	if [ -d /var/spool/noffle/lock ]; then
@@ -14,13 +13,6 @@
 			mv /var/spool/noffle/lock /var/lock/noffle || :
 		fi
 	fi
-	;;
-abort-upgrade)
-	;;
-*)
-	echo "preinst called with unknown argument '$1'" >&2
-	exit 1
-	;;
-esac
+fi
 
 exit 0
--- a/debian/prerm	Sat Feb 22 21:09:23 2003 +0000
+++ b/debian/prerm	Sat Feb 22 21:54:34 2003 +0000
@@ -1,25 +1,22 @@
 #!/bin/sh
-# $Id: prerm 446 2003-02-19 19:06:45Z godisch $
+# $Id: prerm 459 2003-02-22 21:54:34Z godisch $
 
 set -e
-. /usr/share/debconf/confmodule
-db_version 2.0
 
-db_get noffle/port || RET=''
-port="$RET"
-[ -z "$port" -o "$port" = 119 ] && port=nntp
+if [ -x /usr/sbin/invoke-rc.d ]; then
+	invoke-rc.d noffle stop
+elif [ -x /etc/init.d/noffle ]; then
+	/etc/init.d/noffle stop
+fi
 
-case "$1" in
-remove|upgrade|deconfigure)
-	echo "Disabling inet.d entry for noffle..."
+if [ -e /usr/share/debconf/confmodule ]; then
+	. /usr/share/debconf/confmodule
+	db_version 2.0
+	db_get noffle/port || RET=""
+	port="$RET"
+	[ -z "$port" -o "$port" = 119 ] && port=nntp
 	update-inetd --disable $port
-	;;
-failed-upgrade)
-	;;
-*)
-	echo "prerm called with unknown argument '$1'" >&2
-	exit 1
-	;;
-esac
+	db_stop
+fi
 
 exit 0