REQ libXfont
[unleashed-userland.git] / components / gutenprint / gutenprint.startup
blob8027f35b721124687a9f39329d19016153386a44
1 #!/usr/bin/sh
3 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5 # This script should be run from the CUPS scheduler service start method.
7 # usage: /usr/lib/cups/startup/gutenprint <fmri> <pg/prop>
9 # where: <fmri> ... FMRI of the CUPS scheduler service
10 # <pg/prop> ... property group/name where to store status
13 SVC=$1
14 PROP=$2
16 # verify input arguments
17 if [ -z "$SVC" -o -z "$PROP" ] ; then
18 echo "$0: Invalid arguments."
19 echo "usage: $0 <fmri> <pg/prop>"
20 exit 1
23 # package name
24 PKG="pkg:/print/filter/gutenprint"
26 # determine the package version
27 VER=`pkg contents -H -a name=pkg.fmri -o value $PKG | cut -d @ -f 2`
28 if [ -z "$VER" ] ; then
29 echo "$0: Failed to read $PKG package version."
30 exit 1
33 # read the value of status property, if it exists
34 if svcprop -q -p "$PROP" "$SVC" ; then
35 VAL=`svcprop -p "$PROP" "$SVC"`
38 # compare the value with package version
39 if [ "$VAL" = "$VER" ] ; then
40 # PPD files already updated for this package version
41 exit 0
44 # update PPD files
45 if ! /usr/sbin/cups-genppdupdate ; then
46 echo "$0: Failed to update PPD files."
47 exit 1
50 # store status into the SMF repository
51 svccfg -s "$SVC" setprop "$PROP" = astring: "$VER"
53 exit 0