Reputation: 1101
I'd like to add a feature that display the md5sum of currently installing debian file in debian's control file: preinst, is there any way to obtain the full path of debian file ?
Upvotes: 2
Views: 1119
Reputation: 9161
It would be difficult.
Dpkg doesn't export the name of the currently installing file to maintainer scripts in any way, by environment variable or otherwise, and by the time maintainer scripts are run, it doesn't even have a handle to the original .deb file anymore, so even /proc/$pid
inspection won't work. You could make something that would "sometimes" work by looking in apt's cache directory (config item Dir::Cache
, typically /var/cache/apt/
) for a file whose name is something like
${DPKG_MAINTSCRIPT_PACKAGE}_packageversion_${DPKG_MAINTSCRIPT_ARCH}.deb
..where you hardcode the current package version at build time, omitting any epoch field, cause dpkg won't provide you with that in the preinst either. That will work much of the time if you're installing using APT; if you use dpkg -i
or something else, you're out of luck.
A better answer would probably be, why do you want to do that? There is probably a better way to solve whatever your problem is.
Upvotes: 2