gutenprint.startup revision 860
791N/A#!/usr/bin/sh
791N/A#
1302N/A# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
791N/A#
1302N/A# This script should be run from the CUPS scheduler service start method.
791N/A#
791N/A# usage: /usr/lib/cups/startup/gutenprint <fmri> <pg/prop>
919N/A#
919N/A# where: <fmri> ... FMRI of the CUPS scheduler service
919N/A# <pg/prop> ... property group/name where to store status
919N/A#
919N/A
919N/ASVC=$1
919N/APROP=$2
919N/A
919N/A# verify input arguments
919N/Aif [ -z "$SVC" -o -z "$PROP" ] ; then
919N/A echo "$0: Invalid arguments."
919N/A echo "usage: $0 <fmri> <pg/prop>"
919N/A exit 1
919N/Afi
919N/A
919N/A# determine the package version
919N/AVER=`pkg search -Hlo pkg.fmri "$0" | cut -d @ -f 2`
791N/Aif [ -z "$VER" ] ; then
791N/A echo "$0: Failed to read package version."
791N/A exit 1
791N/Afi
1035N/A
791N/A# read the value of status property, if it exists
970N/Aif svcprop -q -p "$PROP" "$SVC" ; then
970N/A VAL=`svcprop -p "$PROP" "$SVC"`
970N/Afi
970N/A
970N/A# compare the value with package version
970N/Aif [ "$VAL" = "$VER" ] ; then
970N/A # PPD files already updated for this package version
970N/A exit 0
970N/Afi
970N/A
1033N/A# update PPD files
970N/Aif ! /usr/sbin/cups-genppdupdate ; then
970N/A echo "$0: Failed to update PPD files."
970N/A exit 1
970N/Afi
1003N/A
970N/A# store status into the SMF repository
1302N/Asvccfg -s "$SVC" setprop "$PROP" = astring: "$VER"
1302N/A
791N/Aexit 0
1033N/A