postinst is in lprng 3.8.B-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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #! /bin/sh
# postinst script for lprng
#
# see: dh_installdeb(1)
set -e
# Source the debconf library.
. /usr/share/debconf/confmodule
update_defaults()
{
db_get lprng/start_lpd
if [ "$RET" = "true" ]; then
START_LPD="yes"
else
START_LPD="no"
fi
cat > /etc/default/lprng <<EOF
#Start the LPRng daemon lpd? Yes or No
START_LPD=$START_LPD
EOF
}
## dsetperms - sets owner, group, and permissions to specified value,
## but only if no dpkg-statoverride entry exists.
## usage: dsetperms user group mode file
dsetperms()
{
if [ "$#" != 4 ] ; then
echo 1>&2 "dsetperms: Requires four arguments"
return 1
fi
if ! dpkg-statoverride --list "$4" > /dev/null 2>&1 ; then
chown "$1":"$2" "$4" || return 1
chmod "$3" "$4" || return 1
else
return 0
fi
}
case "$1" in
install|upgrade)
;;
configure)
# Create directories for pid file
install -d -m 0775 -o root -g lp /var/run/lprng
# Check result of tools being setuid
db_get lprng/setuid_tools
if [ "$RET" = "true" ]; then
dsetperms root root 4755 /usr/bin/lpr
dsetperms root root 4755 /usr/bin/lprm
dsetperms root root 4755 /usr/bin/lpq
else
dsetperms root root 0755 /usr/bin/lpr
dsetperms root root 0755 /usr/bin/lprm
dsetperms root root 0755 /usr/bin/lpq
fi
# Only make the symlink if nothing is there already Bug: #147641
# Check for both a real file and a dangling symlink #544986
if [ ! -e /etc/lprng/printcap ] && [ ! -L /etc/lprng/printcap ] ; then
(cd /etc/lprng ; ln -s ../printcap . )
fi
# Remove sample files form /etc/lprng shouldnever been there
[ -e /etc/lprng/lpd.perms.sample ] && rm /etc/lprng/lpd.perms.sample
[ -e /etc/lprng/lpd.conf.sample ] && rm /etc/lprng/lpd.conf.sample
update_defaults
;;
abort-upgrade)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
# Those using dependency based boot sequencing with sysv-rc and installing
# lprng before version 3.8.A-2.2 would miss the runlevel 4 symlink.
# Recover from this.
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le "3.8.A-2.2" \
&& [ -f /etc/rc2.d/[SK][0-9][0-9]lprng ] && [ -f /etc/rc4.d/K[0-9][0-9]lprng ]
then
update-rc.d -f lprng remove
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installinit
if [ -x "/etc/init.d/lprng" ]; then
if [ ! -e "/etc/init/lprng.conf" ]; then
update-rc.d lprng defaults >/dev/null
fi
invoke-rc.d lprng start || exit $?
fi
# End automatically added section
# Automatically added by dh_installmime
if [ "$1" = "configure" ] && [ -x "`which update-mime 2>/dev/null`" ]; then
update-mime
fi
# End automatically added section
# Urgh, LPPng's lpd seems to be not closing all the file descriptors
# which makes debconf hang, tell debconf to go away
db_stop
# vim:et:sw=4:ts=4:
|