[go: up one dir, main page]

File: cups-daemon.postinst

package info (click to toggle)
cups 2.4.10-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 34,000 kB
  • sloc: ansic: 159,555; cpp: 8,666; sh: 5,479; makefile: 2,783; php: 17; python: 10
file content (44 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /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