Mercurial > noffle
diff debian/config @ 301:3b5b7f3fd71f noffle
[svn] initial debian/ upload
author | godisch |
---|---|
date | Fri, 14 Feb 2003 13:54:32 +0000 |
parents | |
children | 150e75d3c785 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debian/config Fri Feb 14 13:54:32 2003 +0000 @@ -0,0 +1,98 @@ +#!/bin/sh +# $Id: config 434 2003-02-14 13:54:32Z godisch $ + +set -e +. /usr/share/debconf/confmodule +db_version 2.0 + +server_config=/etc/news/noffle.conf +debian_config=/etc/default/noffle + +# for backward compatibility = 1.1.2-1, since postinst is not run yet +if [ ! -e $server_config -a -e /etc/noffle.conf ]; then + server_config=/etc/noffle.conf +fi +# for backward compatibility < 1.1.2-1 +if [ ! -e $server_config -a ! -e $debian_config -a -e /etc/noffle/conf ]; then + server_config=/etc/noffle/conf + debian_config=/etc/noffle/conf.debian +fi + +# are we using debconf? +db_input high noffle/debconf && db_go || : +db_get noffle/debconf || RET="" +[ "$RET" = false ] && exit 0 + +# read server port value from inetd.conf +port="`grep '[[:space:]]/usr/bin/noffle[[:space:]]' /etc/inetd.conf | sed 's/^#<off># //;s/[[:space:]].*//' 2> /dev/null`" || : +if [ "$port" ]; then + # read port value from debconf db + db_get noffle/port || RET="" + # for upgrading from < 1.1.2 + [ "$RET" = 119 ] && RET=nntp + # we need confirmation, if they differ + [ "$port" = "$RET" ] || db_fset noffle/port seen false || : + # write current port from inetd.conf into debconf db + [ "$port" = "${port#\#}" ] && db_set noffle/port "$port" || : +fi + +# read server, username, password, maxfetch, default-expire from $server_config +if [ -s "$server_config" ]; then + db_get noffle/server || RET="" + server="`grep '^server' $server_config | sed 's/^server[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || : + [ "$server" = "$RET" ] || db_fset noffle/server seen false || : + [ "$server" ] && db_set noffle/server "$server" || : + + db_get noffle/username || RET="" + server="`grep '^server' $server_config | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || : + [ "$username" = "$RET" ] || db_fset noffle/username seen false || : + [ "$username" ] && db_set noffle/username "$username" || : + + db_get noffle/password || RET="" + server="`grep '^server' $server_config | sed 's/^server[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[^[:space:]]*[[:space:]]*//;s/[[:space:]].*//' 2> /dev/null`" || : + [ "$password" = "$RET" ] || db_fset noffle/password seen false || : + [ "$password" ] && db_set noffle/password "$password" || : + + db_get noffle/maxfetch || RET="" + maxfetch="`grep '^max-fetch' $server_config | sed 's/^max-fetch[[:space:]]*//' 2> /dev/null`" || : + [ "$maxfetch" = "$RET" ] || db_fset noffle/maxfetch seen false || : + [ "$maxfetch" ] && db_set noffle/maxfetch "$maxfetch" || : + + db_get noffle/default-expire || RET="" + defexpire="`grep '^default-expire' $server_config | sed 's/^default-expire[[:space:]]*//' 2> /dev/null`" || : + [ "$defexpire" = "$RET" ] || db_fset noffle/defexpire seen false || : + [ "$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 +if dpkg --compare-versions "$2" lt-nl 1.1.2; then + db_get noffle/fetchmode || RET="" + case "$RET" in + 'via dialup') db_set noffle/fetchmode ppp || :;; + 'via permanent connection') db_set noffle/fetchmode cron || :;; + esac +fi + +# read NOFFLE_FETCHMODE from $debian_config +[ -s "$debian_config" ] && . $debian_config +[ "$NOFFLE_FETCHMODE" != ppp -a "$NOFFLE_FETCHMODE" != cron ] && \ +if [ -x /usr/sbin/pppd ]; then + NOFFLE_FETCHMODE=ppp +else + NOFFLE_FETCHMODE=cron +fi +# do we need confirmation? +db_get noffle/fetchmode || RET="" +[ "$NOFFLE_FETCHMODE" = "$RET" ] || db_fset noffle/fetchmode seen false || : + +# 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/fetchmode && db_go || : +db_input medium noffle/maxfetch && db_go || : +db_input low noffle/default-expire && db_go || : + +exit 0