mirror of https://gitee.com/openkylin/cups.git
45 lines
1.0 KiB
Bash
45 lines
1.0 KiB
Bash
#! /bin/sh
|
|
|
|
set -e
|
|
|
|
if [ "$1" = configure ]; then
|
|
# Set up lpadmin group.
|
|
if [ -z "`getent group lpadmin`" ]; then
|
|
addgroup --system lpadmin
|
|
fi
|
|
|
|
for i in /etc/cups/classes.conf /etc/cups/printers.conf
|
|
do
|
|
if [ -f $i ] && ! dpkg-statoverride --list $i > /dev/null; then
|
|
chown root:lp $i; chmod 600 $i
|
|
fi
|
|
done
|
|
|
|
# Manage printcap file and associated symlinks
|
|
if [ -e /etc/cups/cupsd.conf ]; then
|
|
if [ -e /etc/printcap.cups ]; then
|
|
rm -f /etc/printcap.cups
|
|
fi
|
|
if [ -L /etc/printcap -a ! -e /etc/printcap ]; then
|
|
rm -f /etc/printcap
|
|
fi
|
|
|
|
printcap_file=`egrep '^Printcap ' /etc/cups/cupsd.conf | awk '{print $2}' | tail -n 1`
|
|
if [ -z "$printcap_file" ]; then
|
|
printcap_file=/run/cups/printcap
|
|
fi
|
|
if [ ! -e /etc/printcap -a -e $printcap_file ]; then
|
|
ln -s $printcap_file /etc/printcap
|
|
fi
|
|
fi
|
|
|
|
# Create default cupsd.conf if it doesn't exist
|
|
if [ ! -r /etc/cups/cupsd.conf ]; then
|
|
cp /usr/share/cups/cupsd.conf.default /etc/cups/cupsd.conf
|
|
fi
|
|
fi
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|