How to know Debian package install location in postinst/prerm?

2

1

The maintainer scripts of Debian package (debian/postinst, debian/prerm, etc.) can optionally have the old/new-version argument, but there's no install dest dir argument. (See Debian Policy Manual)

My package is autotools-based (autoconf & automake), I guess debuild configure the package with DESTDIR="" and prefix=/usr.

Well, though it's uncommon to change DESTDIR or prefix to other values, but maybe it's useful.

For example, if my package is installed to /node-136/usr/local, where DESTDIR=/node-136 and prefix=/usr/local, but how can I know it in the debian/postinst script, so I can do the config munging to the correct installation?

Xiè Jìléi

Posted 2010-09-08T03:11:17.067

Reputation: 14 766

Could you simplify that a little? It's a bit confusing to understand. – digitxp – 2010-09-08T03:18:16.563

I've rewritten the question. – Xiè Jìléi – 2010-09-08T06:59:23.570

I don't understand what you're trying to do here. DESTDIR and prefix are compile-time settings and specific to a particular way of writing a makefile. They have nothing to do with postinst which is executed when the package is installed. – Gilles 'SO- stop being evil' – 2010-09-08T07:20:01.717

For example, if I want to change config file $(DESTDIR)/etc/myconfig, though debuild always set DESTDIR to empty string at build time, but it can be other values. One resolution is, add debian/ to SUBDIRS in Makefile.am, and rename debian/postinst to debian/postinst.in and refer to @DESTDIR@/etc/myconfig. But I deem it's not recommended, since debian/* is not a part of the source. Though, DESTDIR and prefix are compile-time, but debian/ is not involved in the compilation. – Xiè Jìléi – 2010-09-08T13:14:31.217

Answers

0

I guess DESTDIR is not used in dh_make.

Xiè Jìléi

Posted 2010-09-08T03:11:17.067

Reputation: 14 766