#!/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)"

    cat >> /etc/cups/cupsd.conf <<EOF
# Begin configurations for gutenbach

<Location /printers/$printername>
    Order Deny, Allow
    Allow from All
</Location>

Group audio

# End configurations for gutenbach
EOF

    /etc/init.d/cups reload

else
    echo "Error: /usr/lib/gutenbach/config/printername does not exist"
    exit 1
fi