source: server/inst/cups-set-perms @ 30beeab

debianmacno-cupsweb
Last change on this file since 30beeab was 30beeab, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Remove "gutenbach-" from directory names and rename "gutenbach" to "gutenbach-server"

  • Property mode set to 100755
File size: 1.2 KB
Line 
1#!/bin/sh
2
3# Set the CUPS permissions such that anyone can add/remove jobs
4# from the queue for gutenbach.
5
6if [ -e /usr/lib/gutenbach/config/printername ]; then
7    printername="$(cat /usr/lib/gutenbach/config/printername)"
8
9    conffile="/etc/cups/cupsd.conf"
10    mv "$conffile" "$conffile.bak"
11    touch "$conffile"
12
13    while read line; do
14        listen_localhost=$(echo "$line" | grep '^Listen localhost' || true)
15        if [ -n "$listen_localhost" ]; then
16            echo "#GUTENBACH$line" >> "$conffile"
17        else
18            root_location=$(echo "$line" | grep '^<Location />$' || true)
19            if [ -n "$root_location" ]; then
20                echo "<Location />" >> "$conffile"
21                echo "Allow from All # added by Gutenbach" >> "$conffile"
22            else
23                echo "$line" >> "$conffile"
24            fi
25        fi
26
27    done < "$conffile.bak"
28    rm "$conffile.bak"
29
30    cat >> "$conffile" <<EOF
31# Begin configurations for gutenbach
32
33Group audio
34Listen *
35ServerAlias *
36
37<Location /printers/$printername>
38    <Limit Cancel-Job Purge-Jobs CUPS-Authenticate-Job>
39        Order deny,allow
40        Allow from All
41    </Limit>
42
43    Order Deny, Allow
44    Allow from All
45</Location>
46
47# End configurations for gutenbach
48EOF
49
50    /etc/init.d/cups reload
51
52else
53    echo "Error: /usr/lib/gutenbach/config/printername does not exist"
54    exit 1
55fi
Note: See TracBrowser for help on using the repository browser.