[Pkg-cups-devel] Bug#774918: cups-pdf, copyright file missing: postinst script ?

Hugo Lefeuvre hugo6390 at fr33tux.org
Sat Jan 10 00:56:53 UTC 2015


Hi,

The problem seems to be that an old version of cups-pdf (maybe 2.6.1-6)
was using directories for its documentation (especially d/copyright) and 
that a new version of the package asked debian/rules to use symlinks
instead of installing the same documentation twice:

> override_dh_installdocs:
>     dh_installdocs --link-doc=printer-driver-cups-pdf

Unfortunately, dpkg can't replace directories with a symlink without help, 
so that an update from the old documentation system to the new will not be 
possible and will leave /usr/share/doc/cups-pdf empty. It's a violation of 
policy 12.5.

A solution could be to write a script that checks the version of the old 
cups-pdf installed on the system and removes the documentation if the 
installed version of cups-pdf was using directories for its documentation 
(so, if the installed cups-pdf < cups-pdf_2.6.1-10). 

The wiki[0] advices to write a postinst script to do the trick. I've
adapted the given example[1], and tried it on my system. It seems to work. 
The script is in attachment. I hope this could help. :)

Thanks !

Cheers,
 Hugo

[0] https://wiki.debian.org/MissingCopyrightFile
[1] http://anonscm.debian.org/cgit/collab-maint/mlterm.git/tree/debian/mlterm-im-ibus.preinst

-- 
      Hugo Lefeuvre (hugo6390)    |    www.hugo6390.org
4096/ ACB7 B67F 197F 9B32 1533 431C AC90 AC3E C524 065E
-------------- next part --------------
#!/bin/sh
set -e

case "$1" in
    install|upgrade)
        # dpkg does not replace directories by symlinks or vice versa.
        if dpkg --compare-versions "$2" lt "2.6.1-10" ; then
          echo "#rm -rf /usr/share/doc/cups-pdf"
          rm -rf /usr/share/doc/cups-pdf || true
        fi
    ;;
    abort-upgrade)
    ;;
    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-cups-devel/attachments/20150110/cada5d8b/attachment.sig>


More information about the Pkg-cups-devel mailing list