On Sun, Jul 03, 2016 at 10:12:44AM +0200, Christoph Biedl wrote:
> > if [ -d /usr/share/doc/systemd-sysv/ ] ; then
>
> Unfortunately not that way, by Policy 12.3:
>
> | Packages must not require the existence of any files in
> | /usr/share/doc/ in order to function.
It's arguable whether that **requires** the existence of a file/dir in
order to function, it's just using the existence to decide which method
to use for loading the module(s).
the next best method (slower, from calling dpkg-query and grep, but just
as certain if not more so) would be to use dpkg-query:
if dpkg-query --show --showformat '${status}\n' systemd-sysv |
grep -q " installed$" ; then
or, with short options:
if dpkg-query -W -f '${status}\n' systemd-sysv |
grep -q " installed$" ; then
It should be possible to run dpkg-query in a postinst, it's a read-only
operation so isn't affected by the lock.
BTW, the space in " installed$" is essential, as "not-installed" is also
valid there.
Also, the '\n' in the format string isn't strictly necessary, but some
tools (not grep) ignore the last line of input if it isn't terminated by
a newline.
craig
--
craig sanders <[email protected]>