changeset 395:056d5fcb7f4b noffle

[svn] updated deb'configuration
author godisch
date Thu, 29 May 2003 15:44:56 +0100
parents 3d3a0dab6011
children e144202d2d96
files debian/changelog debian/config debian/control debian/postinst
diffstat 4 files changed, 82 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/debian/changelog	Sat May 24 19:48:30 2003 +0100
+++ b/debian/changelog	Thu May 29 15:44:56 2003 +0100
@@ -1,10 +1,9 @@
 noffle (1.1.4-8) unstable; urgency=low
 
-  * Added debconf-2.0 dependency option.
-  * Fixed postrm
+  * Updated deb'configuration, made it optional.
   * Updated standards version.
 
- -- Martin A. Godisch <godisch@debian.org>  Sat, 24 May 2003 08:30:15 +0200
+ -- Martin A. Godisch <godisch@debian.org>  Thu, 29 May 2003 16:35:10 +0200
 
 noffle (1.1.4-7) unstable; urgency=low
 
--- a/debian/config	Sat May 24 19:48:30 2003 +0100
+++ b/debian/config	Thu May 29 15:44:56 2003 +0100
@@ -1,11 +1,19 @@
 #!/bin/sh
-# $Id: config 503 2003-03-29 08:06:12Z godisch $
+# $Id: config 537 2003-05-29 14:44:56Z 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
+
 server_config=/etc/news/noffle.conf
 debian_config=/etc/default/noffle
 
@@ -19,14 +27,6 @@
 	debian_config=/etc/noffle/conf.debian
 fi
 
-# are we using debconf?
-db_input high noffle/debconf && db_go || :
-db_get noffle/debconf
-if [ "$RET" = false ]; then
-	db_stop
-	exit 0
-fi
-
 # read server port value from inetd.conf
 port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | head -n 1 | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || :
 if [ "$port" ]; then
--- a/debian/control	Sat May 24 19:48:30 2003 +0100
+++ b/debian/control	Thu May 29 15:44:56 2003 +0100
@@ -7,8 +7,9 @@
 
 Package: noffle
 Architecture: any
-Depends: ${shlibs:Depends}, netbase | openbsd-inetd | inetd-superserver, exim | mail-transport-agent, debconf (>= 0.5) | debconf-2.0
-Recommends: sysklogd | system-log-daemon
+Depends: ${shlibs:Depends}, netbase | openbsd-inetd | inetd-superserver, exim | mail-transport-agent
+Recommends: debconf (>= 0.5) | debconf-2.0, sysklogd | system-log-daemon
+Conflicts: debconf (<< 0.5)
 Suggests: slrn | news-reader
 Provides: news-transport-system
 Description: offline news server
--- a/debian/postinst	Sat May 24 19:48:30 2003 +0100
+++ b/debian/postinst	Thu May 29 15:44:56 2003 +0100
@@ -1,13 +1,10 @@
 #!/bin/sh
-# $Id: postinst 499 2003-03-29 06:57:20Z godisch $
+# $Id: postinst 537 2003-05-29 14:44:56Z godisch $
 
 set -e
 
 [ "$1" = configure ] || exit 0
 
-. /usr/share/debconf/confmodule
-db_version 2.0
-
 server_config=/etc/news/noffle.conf
 debian_config=/etc/default/noffle
 
@@ -35,57 +32,75 @@
 	mv -f /etc/noffle.conf.old $server_config.old 2> /dev/null || :
 fi
 
-db_get noffle/debconf
-if [ "$RET" != false ]; then
-	db_get noffle/port
-	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
-	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
+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"
+		[ -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
+		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
 	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 || :
+	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
-	# $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
+	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
 fi
 
 # sanity checks
@@ -110,5 +125,4 @@
 	sleep 2
 fi
 
-db_stop
 exit 0