This file is indexed.

postinst is in cups-daemon 1.7.2-0ubuntu1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#! /bin/sh
# postinst script for cups-daemon
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

# Default Configuration file
if [ -e /etc/default/cups ]; then
	. /etc/default/cups
fi

if [ "$1" = configure ]; then
    # Set up lpadmin group.
    if [ -z "`getent group lpadmin`" ]; then 
	addgroup --system lpadmin
    fi

    if [ -f /etc/cups/classes.conf ]; then
      chown root:lp /etc/cups/classes.conf ; chmod 600 /etc/cups/classes.conf
    fi
    if [ -f /etc/cups/printers.conf ]; then
      chown root:lp /etc/cups/printers.conf ; chmod 600 /etc/cups/printers.conf
    fi

    # symlink snakeoil SSL certificate if present
    if [ -e /etc/ssl/certs/ssl-cert-snakeoil.pem -a \
	  -e /etc/ssl/private/ssl-cert-snakeoil.key -a \
	  -n "`getent group ssl-cert`" -a ! -e /etc/cups/ssl/server.crt \
	  -a ! -e /etc/cups/ssl/server.key -a ! -h /etc/cups/ssl/server.crt \
	  -a ! -h /etc/cups/ssl/server.key ]; then
	 ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/cups/ssl/server.crt
	 ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/cups/ssl/server.key
    fi

    # Clear cache if we upgrade to 1.4.x
    if dpkg --compare-versions "$2" lt-nl "1.4.1-5"; then
	rm /var/cache/cups/* 2> /dev/null || :
    fi

    # Clear PPD cache if we upgrade to 1.5.x
    if dpkg --compare-versions "$2" lt-nl "1.5.0-3"; then
	rm /var/cache/cups/ppds.dat 2> /dev/null || :
    fi

    # 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=/var/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
        if dpkg --compare-versions "$2" le "1.6.1" && [ -e /etc/cups/cupsd.conf.conffile-bak ]; then
            # Move cupsd.conf back as it is now a non-conffile
            mv /etc/cups/cupsd.conf.conffile-bak /etc/cups/cupsd.conf
        else
            cp /usr/share/cups/cupsd.conf.default /etc/cups/cupsd.conf
        fi
    fi

    # Remove lines from cupsd.conf which got obsolete in CUPS 1.6.x and would
    # prevent the CUPS daemon from starting due to being invalid now.
    if dpkg --compare-versions "$2" le "1.6.4"; then
        # Backup pre-1.6 cupsd.conf for cups-browsed upgrade path
        cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.pre16-bak

        cat /etc/cups/cupsd.conf | grep -Eiv '^\s*Browse(Order|Allow|Deny|Poll|RemoteProtocols)' > /etc/cups/cupsd.conf.new
        if [ -r /etc/cups/cupsd.conf.new ]; then
            if ! diff -q /etc/cups/cupsd.conf /etc/cups/cupsd.conf.new > /dev/null 2>&1; then
                mv -f /etc/cups/cupsd.conf.new /etc/cups/cupsd.conf
            else
                rm /etc/cups/cupsd.conf.new
            fi
        fi
        # Also the argument "cups" for BrowseLocalProtocols is obsolete. Remove the
        # argument and put "dnssd" if there are no arguments left.
        cat /etc/cups/cupsd.conf | perl -p -e 's/^(\s*BrowseLocalProtocols.*?)\s+cups/$1/i; s/^(\s*BrowseLocalProtocols)(\s*)$/$1 dnssd$2/i' > /etc/cups/cupsd.conf.new
        if [ -r /etc/cups/cupsd.conf.new ]; then
            if ! diff -q /etc/cups/cupsd.conf /etc/cups/cupsd.conf.new > /dev/null 2>&1; then
                mv -f /etc/cups/cupsd.conf.new /etc/cups/cupsd.conf
            else
                rm /etc/cups/cupsd.conf.new
            fi
        fi
    fi
fi

# Automatically added by dh_apparmor
if [ "$1" = "configure" ]; then
    APP_PROFILE="/etc/apparmor.d/usr.sbin.cupsd"
    if [ -f "$APP_PROFILE" ]; then
        # Add the local/ include
        LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.sbin.cupsd"

        test -e "$LOCAL_APP_PROFILE" || {
            tmp=`mktemp`
        cat <<EOM > "$tmp"
# Site-specific additions and overrides for usr.sbin.cupsd.
# For more details, please see /etc/apparmor.d/local/README.
EOM
            mkdir `dirname "$LOCAL_APP_PROFILE"` 2>/dev/null || true
            mv -f "$tmp" "$LOCAL_APP_PROFILE"
            chmod 644 "$LOCAL_APP_PROFILE"
        }

        # Reload the profile, including any abstraction updates
        if aa-status --enabled 2>/dev/null; then
            apparmor_parser -r -T -W "$APP_PROFILE" || true
        fi
    fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/cups" ] || [ -e "/etc/init/cups.conf" ]; then
	if [ ! -e "/etc/init/cups.conf" ]; then
		update-rc.d cups defaults >/dev/null
	fi
	invoke-rc.d cups start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f cups remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper rm_conffile /etc/cups/cupsd.conf.default 1.7.1-3~ -- "$@"
# End automatically added section


exit 0