[Gllug] debian packaging question - env vars?
Philip Hands
phil at hands.com
Thu Aug 2 06:01:20 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Trevena wrote:
> Hi all,
>
> Any debian packaging bods know if I could get any useful information
> from %ENV when a makefile is executed when installing a debian
> package?
>
> We're deploying configuration files in debian packages, but would like
> to backup before replacing files - ideally with a useful name linked
> to either the change control ticket (not really feasible unless manual
> - probably via a symlink) or the version of the package.
>
> I suppose I could set this manually each time I update the package but
> that's a bit sucky.
>
> Any suggestions?
I think the answer to your question is here:
http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html#s-mscriptsinstact
You probably want to do your backing-up in the new package's preinst, which
will be called with the old package's version as the 2nd parameter after
"upgrade" as the first parameter.
Rather than doing what you're suggesting though, you should probably go the
extra mile, and instead do as is suggested here:
http://www.debian.org/doc/debian-policy/ap-pkg-conffiles.html#sE.2
by having the files in question generated by a script, and putting any
settings that are needed locally into debconf questions that can be used by
such a script.
If you want to put the change control ticket into the thing, one way would
be to use that as the last bit of the new package's version number,
probably after a dot, and then use that via substitution variables in the
debian/rules to put it into the preinst.
You can also specify a new variable using -V and use that, but that
requires you to remember to build your packages in an odd way, unless you
make the debian/rules file bail out with an appropriate error if you've
forgotten to set it.
See the VARIABLE SUBSTITUTION section of dpkg-source(1):
http://hands.com/cgi-bin/dwww?type=runman&location=dpkg-source/1
for the details on how that works.
Hope that helps.
Cheers, Phil.
- --
|)| Philip Hands [+44 (0)20 8530 9560] http://www.hands.com/
|-| HANDS.COM Ltd. http://www.uk.debian.org/
|(| 10 Onslow Gardens, South Woodford, London E18 1NE ENGLAND
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGsXMtYgOKS92bmRARAioMAJ442MjIqOc6rYhoFiA3qMs2y+JbtgCfa1mZ
fazAdnFzQRsP8S6r023cuII=
=VDd0
-----END PGP SIGNATURE-----
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list