[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: configuration file question



Remco van de Meent wrote:
> Hey,
> 
> I hope you can help me with this one...
> 
> 
> In Incoming on master, there is webalizer_1.20-2_i386.deb. The package
> itself works fine (at least, as far as I can test it), but I have a problem
> concerning the upgrade from an earlier version of webalizer.
> 
> The Packaging Manual states that one shouldn't touch the files listed in
> debian/conffiles in the debian/postinst script. OK, but I can't get that to
> work.
> 
> In postinst, I want the user to be able to change the contents of the
> conffile, /etc/webalizer.conf. This is done by some magic using sed. But
> what if there already is a /etc/webalizer.conf? Now the user gets asked to
> fill in the new values, though that isn't necessairy when upgrading. It
> just needs to be asked when installing.

You can check the arguments set for the postinst.  From memory this is:

postinst configure new-version

for a new installation and

postinst configure new-version old-version

for an upgrade.  Before using this, test it and check the documentation
in ftp.debian.org/pub/debian/doc/ It's written down somewhere.

> How do I do that?

You are able to do

if [ -f /etc/webalizer.conf ]
then
  skip_it
fi

You are also able to put some magic code in that file in order to let
the postinst know that the file is not initialized.  This could be
done by adding

# UNINITIALIZED CONFFILE

to the webalizer.conf file that you ship together with the package.

And as a third you can check against your default values if you know
that they won't make sense outside of 'default'.

Regards,

	Joey

-- 
A mathematician is a machine for converting coffee into theorems.


--  
To UNSUBSCRIBE, email to debian-mentors-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: