| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
case "$1" in |
| 6 |
configure) |
| 7 |
# add hplip system user (requires adduser >= 3.34) |
| 8 |
# don't muck around with this unless you KNOW what you're doing |
| 9 |
echo "Creating/updating hplip user account..." |
| 10 |
adduser --system --ingroup lp --home /run/hplip \ |
| 11 |
--gecos "HPLIP system user" --shell /bin/false \ |
| 12 |
--quiet --disabled-password hplip || { |
| 13 |
# adduser failed. Why? |
| 14 |
if getent passwd hplip >/dev/null ; then |
| 15 |
echo "Non-system user hplip found. I will not overwrite a non-system" >&2 |
| 16 |
echo "user. Remove the user and reinstall hplip." >&2 |
| 17 |
exit 1 |
| 18 |
fi |
| 19 |
# unknown adduser error, simply exit |
| 20 |
exit 1 |
| 21 |
} |
| 22 |
|
| 23 |
# Statoverrides in ephemeral directories don't work. They should be removed (#952580) |
| 24 |
for i in /run/hplip /var/run/hplip |
| 25 |
do |
| 26 |
if dpkg-statoverride --list $i > /dev/null; then |
| 27 |
dpkg-statoverride --remove $i |
| 28 |
fi |
| 29 |
done |
| 30 |
|
| 31 |
# Adjust permissions and ownerships of the /var/log/hp/tmp (fax spool) |
| 32 |
# directory (https://bugs.launchpad.net/bugs/1187132) |
| 33 |
for i in /var/log/hp/tmp |
| 34 |
do |
| 35 |
if ! dpkg-statoverride --list $i > /dev/null; then |
| 36 |
dpkg-statoverride --update --add root lp 775 $i |
| 37 |
fi |
| 38 |
done |
| 39 |
|
| 40 |
|
| 41 |
# Remove shutdown and reboot links; this init script does not need them. |
| 42 |
if dpkg --compare-versions "$2" lt "1.7.3-0ubuntu4"; then |
| 43 |
update-rc.d -f hplip remove |
| 44 |
fi |
| 45 |
|
| 46 |
# Fix PPD file paths in /etc/hp/hplip.conf to make sure that hp-setup |
| 47 |
# finds the fax PPDs |
| 48 |
perl -p -i -e 's:^(\s*ppd=).*$:\1/usr/share/ppd/hplip/HP:' /etc/hp/hplip.conf |
| 49 |
perl -p -i -e 's:^(\s*ppdbase=).*$:\1/usr/share/ppd/hplip:' /etc/hp/hplip.conf |
| 50 |
;; |
| 51 |
|
| 52 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 53 |
;; |
| 54 |
|
| 55 |
*) |
| 56 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 57 |
exit 1 |
| 58 |
;; |
| 59 |
esac |
| 60 |
|
| 61 |
#DEBHELPER# |
| 62 |
|
| 63 |
exit 0 |