postinst is in gpr 0.15deb-2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #!/bin/sh -e
#log_failure_msg () {
# echo "$@"
#}
#[ -r /lib/lsb/init-functions ] && source /lib/lsb/init-functions
W=/usr/lib/gpr/lpr.wrapper
D=/usr/bin/lpr.not.gpr
L=/usr/bin/lpr
if [ "$1" = reconfigure ] || [ "$1" = configure ] ; then
. /usr/share/debconf/confmodule
db_get gpr/divert_lpr
db_stop
if [ "$RET" = "true" ]; then
####### install lpr wrapper
#add diversion
if dpkg-divert --list gpr | grep -q $D ; then : ; else
dpkg-divert --package gpr --add --rename \
--divert $D $L
fi
#check (and create) link
if [ ! -e $L ] ; then
ln -s $W $L
elif [ ! -L $L ] ; then
echo gpr problem: $L exists and is not a symlink 1>&2
exit 1
elif find $L -printf '%l' | grep -q $W ; then
true
elif find $L -printf '%l' | grep -q $D ; then
#legacy from older versions
rm $L
ln -s $W $L
else
echo gpr problem: symlink $L does not point to $W 1>&2
exit 2
fi
####### deinstall lpr wrapper
else
#act only if diversion is there
if dpkg-divert --list gpr | grep -q $D ; then
#remove the link?
if [ -L $L ] && find $L -printf '%l' | egrep -q "$W|$D" ; then
rm $L
fi
#remove the diversion?
if [ -e $L ] ; then
echo gpr problem: $L exists, cannot remove diversion 1>&2
exit 5
else
dpkg-divert --package gpr --remove --rename \
--divert $D $L
fi
fi
fi
fi
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
update-menus
fi
# End automatically added section
|