#! /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 <&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/13.15.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/lprng" ]; then update-rc.d lprng defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native lprng $_dh_action || exit 1 fi 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: