postinst howto q's
I'm preparing a new release of my pppupd package and I want to correct
some things which though not harmful are annoying.
pppupd ships with a conffile which needs to be customized for each
individual installation so I ask some questions in the postinst. However
if a person is upgrading from a previous version of the package, chances
are he will have already done the customization. In this case I don't
want to annoy him by asking him (and possibly damage his working
configuration) by asking him the questions again. Right now I check the
existence of /etc/pppupd.cf (the conffile) and skip the questions if it
doesn't exist. But this doesn't really work because by the time the
configure phase of postinst occurs dpkg has already unpacked the default
conffile unless the user has an existing one and answered no when dpkg
asked to replace it. In either case /etc/pppupd.cf will exist. Thus:
Q1. How can I tell if the conffile is the package default or a
One way I thought of was to look for the existance of
/etc/pppupd.cf.dpkg-dist but I don't think this is too reliable. Am I
pppud being a daemon to keep ppp connections alive, is pretty useless
unless ppp is correctly configured (not just installed) first. Currently
what I do is to ask the user in the postinst if ppp is correctly configured
first. I only proceed if he answers yes. I dislike this because
interactive prompting should be kept as minimal as possible. Thus:
Q2: How can I reliably determine if a package has been configured?
Again I thought of one possible solution. Do a dpkg -l ppp and if the
second character on the line is i, it means the package has been correctly
installed. Is there a better way than this?
Any advice gratefully received.
Jaldhar H. Vyas <email@example.com>
To UNSUBSCRIBE, email to firstname.lastname@example.org
with a subject of "unsubscribe". Trouble? Contact email@example.com