#!/bin/sh
# Set the CUPS permissions such that anyone can add/remove jobs
# from the queue for gutenbach.
if [ -e /usr/lib/gutenbach/config/printername ]; then
printername="$(cat /usr/lib/gutenbach/config/printername)"
conffile="/etc/cups/cupsd.conf"
mv "$conffile" "$conffile.gutenbach-orig"
touch "$conffile"
cat >> "$conffile" <
Allow from All
Order deny,allow
# Restrict access to the admin pages...
Encryption Required
Order deny,allow
# Restrict access to configuration files...
AuthType Default
Require user @SYSTEM
Order deny,allow
# Set the default printer/job policies...
# Job-related operations must be done by the owner or an administrator...
Allow from All
Order deny,allow
# All administration operations require an administrator to authenticate...
AuthType Default
Require user @SYSTEM
Order deny,allow
# All printer operations require a printer operator to authenticate...
AuthType Default
Require user @SYSTEM
Order deny,allow
Order deny,allow
Order deny,allow
Allow from All
Order deny,allow
Allow from All
EOF
/etc/init.d/cups reload
else
echo "Error: /usr/lib/gutenbach/config/printername does not exist"
exit 1
fi