Package: pine Severity: normal Tags: patch
The package built by this source package does not use debconf to ask its questions. The result is that (a) it overwrites the /etc/news/servers and /etc/mailname files which are configured with debconf elsewhere (say, by slrn or exim) and more seriously (b) it makes it impossible for the resulting package to be installed using FAI, since the fully automated install stops to ask the questions. I have modified the source package to build a pine package which uses debconf, and the patch is attached. -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (500, 'testing') Architecture: alpha Kernel: Linux 2.6.6 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) -- Patch: diff -ruN pine-4.62/debian/config ../pine-4.62/debian/config --- pine-4.62/debian/config 1970-01-01 01:00:00.000000000 +0100 +++ ../pine-4.62/debian/config 2005-01-27 12:28:51.000000000 +0000 @@ -0,0 +1,50 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule +db_version 2.0 + +# The following debconf magic comes from the slrn package + +db_beginblock + +if [ ! -s /etc/news/server ]; then + # No news server file currently exists (or it's empty). + db_get shared/news/server + SERVER="$RET" + # If there is no server set, try to guess a good value. + if [ -z "$SERVER" ]; then + NETNAME="`hostname -d`" || true + if [ ! -z "$NETNAME" ]; then + db_set shared/news/server "news.$NETNAME" + fi + fi +else + # Reconfiguring the package, or a news server file already exists. + # Still ask the question, though it may or may not be seen. Just + # use the first line of the file now as the default answer. + db_set shared/news/server "`head -1 /etc/news/server`" + # Effectively, the question is seen -- since the file is set up.. + db_fset shared/news/server seen true +fi +db_input medium shared/news/server || true + +if [ ! -s /etc/mailname ]; then + # No /etc/mailname file, or it's empty, so prompt for the mailname. + db_get shared/mailname + MAILNAME="$RET" + if [ -z "$MAILNAME" ]; then + db_set shared/mailname "`hostname --fqdn`" || db_set shared/mailname "`hostname`" + fi +else + # Reconfiguring the package, or a mailname file already exists. + # Still ask the question, though it may not be seen. Just use the + # first line of the file now as the default answer. + db_set shared/mailname "`head -1 /etc/mailname`" + # Effectively, the question is seen -- since the file is set up.. + db_fset shared/mailname seen true +fi +db_input medium shared/mailname || true + +db_endblock + +db_go || true diff -ruN pine-4.62/debian/postinst ../pine-4.62/debian/postinst --- pine-4.62/debian/postinst 2005-01-27 14:51:12.000000000 +0000 +++ ../pine-4.62/debian/postinst 2005-01-27 14:34:11.000000000 +0000 @@ -1,66 +1,39 @@ #!/bin/sh set -e -syshostname=`hostname --fqdn` +. /usr/share/debconf/confmodule -## figure out the system's mailname +syshostname=`hostname --fqdn` -if [ -f /etc/mailname ]; then - mailname=`cat /etc/mailname` -else - echo 'Please enter the "mail name" of your system. This is the hostname' - echo 'portion of the address to be shown on outgoing news and mail messages.' - echo "The default is $syshostname, your system's host name." - echo - echo -n "Mail name [$syshostname]: " - read mailname - echo - if [ "$mailname" ]; then - echo $mailname >/etc/mailname - else - echo $syshostname >/etc/mailname - fi -fi +if [ $1 = configure ]; then -## figure out the default NNTP server + mkdir -p /etc/news -if [ ! -d /etc/news ]; then - mkdir /etc/news -fi + db_get shared/news/server + servername="$RET" + echo "$RET" > /etc/news/server -if [ -s /etc/news/server ]; then - servername=`grep -v ^# /etc/news/server` -else - echo 'There is no "default NNTP server" defined for your system. This' - echo 'address is used by Pine and other programs to configure the default' - echo 'news server. Please enter the "server" name you wish to use.' - echo "The default is $syshostname, your system's host name." - echo - echo -n "Server name [$syshostname]: " - read servername - echo - if [ "$servername" ]; then - echo $servername >/etc/news/server - else - echo $syshostname >/etc/news/server - fi -fi + db_get shared/mailname + mailname="$RET" + echo "$RET" > /etc/mailname ## Create /etc/pine.conf if it does not exist: ## user-domain=$mailname if the mailname doesn't equal the hostname. ## nntp-server=$servername if the news servername doesn't equal the hostname. -if [ ! -f /etc/pine.conf ]; then - if [ "$mailname" != "$syshostname" ]; then - expr1="s/^\(user-domain=\).*$/\1$mailname/" - fi - if [ "$servername" != "$syshostname" ]; then - expr2="s/^\(nntp-server=\).*$/\1$servername/" - fi - expr3="s/^\(character-set=\).*$/\1iso-8859-1/" - pine -conf | sed -e "$expr1" -e "$expr2" -e "$expr3" > /etc/pine.conf -fi + if [ ! -f /etc/pine.conf ]; then + if [ "$mailname" != "$syshostname" ]; then + expr1="s/^\(user-domain=\).*$/\1$mailname/" + fi + if [ "$servername" != "$syshostname" ]; then + expr2="s/^\(nntp-server=\).*$/\1$servername/" + fi + expr3="s/^\(character-set=\).*$/\1iso-8859-1/" + pine -conf | sed -e "$expr1" -e "$expr2" -e "$expr3" > /etc/pine.conf + fi + + if [ -x /usr/bin/update-menus ]; then + update-menus + fi -if [ -x /usr/bin/update-menus ]; then - update-menus fi diff -ruN pine-4.62/debian/postrm ../pine-4.62/debian/postrm --- pine-4.62/debian/postrm 2005-01-27 14:51:12.000000000 +0000 +++ ../pine-4.62/debian/postrm 2005-01-27 12:38:50.000000000 +0000 @@ -1,7 +1,11 @@ #!/bin/sh set -e + +. /usr/share/debconf/confmodule + if [ "$1" = "purge" ]; then - cd /etc && rm -f pine.conf pine.conf.fixed pine.info + db_purge + cd /etc && rm -f pine.conf pine.conf.fixed pine.info fi if [ -x /usr/bin/update-menus ]; then update-menus diff -ruN pine-4.62/debian/rules ../pine-4.62/debian/rules --- pine-4.62/debian/rules 2005-01-27 14:51:12.000000000 +0000 +++ ../pine-4.62/debian/rules 2005-01-27 13:51:24.000000000 +0000 @@ -58,7 +58,7 @@ rm -rf debian/$@ install -d debian/$@/DEBIAN debian/$@/usr/share/doc/$@ cd debian/$@ && install -d usr/bin usr/share/man/man1 usr/lib/menu - cd debian && install -m 755 postinst postrm $@/DEBIAN + cd debian && install -m 755 config templates postinst postrm $@/DEBIAN cd debian && install -m 644 menu.pine $@/usr/lib/menu/pine $(INSTALL_PROGRAM) bin/pine debian/$@/usr/bin ln -s pine debian/$@/usr/bin/pinef diff -ruN pine-4.62/debian/templates ../pine-4.62/debian/templates --- pine-4.62/debian/templates 1970-01-01 01:00:00.000000000 +0100 +++ ../pine-4.62/debian/templates 2005-01-27 14:37:23.000000000 +0000 @@ -0,0 +1,14 @@ +Template: shared/news/server +Type: string +Description: What news server should be used for reading and posting news? + What news server (NNTP server) should be used for reading and posting + news? + . + Enter the fully qualified domain name of the server. + +Template: shared/mailname +Type: string +Description: Please enter the mail name of your system: + The "mail name" is the hostname portion of the address to be shown on + outgoing news and mail messages. + -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]