7156212 spooled files won't actually print after upgrade from build 10 to build 12
authorPetr Cvachoucek <petr.cvachoucek@oracle.com>
Thu, 10 May 2012 22:29:43 -0700
changeset 810 297dc5ace0d5
parent 809 b76ab22e7d0c
child 811 8ceb92d2e883
7156212 spooled files won't actually print after upgrade from build 10 to build 12
components/cups/Solaris/svc-cupsd
components/cups/cups.p5m
components/cups/patches/17-smf-start-method.patch
components/gutenprint/gutenprint.p5m
components/gutenprint/gutenprint.startup
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/cups/Solaris/svc-cupsd	Thu May 10 22:29:43 2012 -0700
@@ -0,0 +1,33 @@
+#!/usr/bin/ksh
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Standard prolog
+#
+. /lib/svc/share/smf_include.sh
+
+if [ -z "$SMF_FMRI" ] ; then
+	echo "SMF framework variables are not initialized."
+	exit $SMF_EXIT_ERR_NOSMF
+fi
+
+# directory where to look for startup scripts
+STARTUP=/usr/lib/cups/startup
+
+# for all startup scripts found in the directory
+for SCRIPT in $STARTUP/* ; do
+	# verify the script is executable
+	[ -x "$SCRIPT" ] || continue
+	# execute the script
+	if ! "$SCRIPT" "$SMF_FMRI" "startup/${SCRIPT##*/}" ; then
+		echo "Warning: startup script $SCRIPT failed."
+	fi
+done
+
+# execute the CUPS daemon
+exec /usr/sbin/cupsd
+
+# fatal error, failed to execute CUPS daemon
+exit $SMF_EXIT_ERR_FATAL
--- a/components/cups/cups.p5m	Thu May 10 17:18:01 2012 -0700
+++ b/components/cups/cups.p5m	Thu May 10 22:29:43 2012 -0700
@@ -81,6 +81,7 @@
 dir path=usr/lib/cups/filter
 dir path=usr/lib/cups/monitor
 dir path=usr/lib/cups/notifier
+dir path=usr/lib/cups/startup
 
 # SMF help dir
 dir path=usr/lib/help/auths/locale/C
@@ -177,6 +178,9 @@
 file path=lib/svc/manifest/application/cups.xml mode=0444 \
      restart_fmri=svc:/system/manifest-import:default
 
+# SMF service start method script
+file Solaris/svc-cupsd path=lib/svc/method/svc-cupsd
+
 # SMF help
 file Solaris/ManageCUPS.html mode=0444 \
      path=usr/lib/help/auths/locale/C/ManageCUPS.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/cups/patches/17-smf-start-method.patch	Thu May 10 22:29:43 2012 -0700
@@ -0,0 +1,20 @@
+--- init/cups.xml.in.orig	Fri Apr 13 05:21:47 2012
++++ init/cups.xml.in	Fri Apr 13 05:22:51 2012
[email protected]@ -71,7 +71,7 @@
+         <exec_method
+             type='method'
+             name='start'
+-            exec='@[email protected]/cupsd'
++            exec='/lib/svc/method/svc-cupsd'
+             timeout_seconds='60' >
+             <method_context>
+                 <method_credential user='root' group='@[email protected]' />
[email protected]@ -87,6 +87,8 @@
+                 value='solaris.smf.manage.cups' />
+         </property_group>
+ 
++        <property_group name='startup' type='application' />
++
+         <template>
+             <common_name>
+                 <loctext xml:lang='C'>
--- a/components/gutenprint/gutenprint.p5m	Thu May 10 17:18:01 2012 -0700
+++ b/components/gutenprint/gutenprint.p5m	Thu May 10 22:29:43 2012 -0700
@@ -44,6 +44,7 @@
 dir path=usr/lib/cups
 dir path=usr/lib/cups/driver
 dir path=usr/lib/cups/filter
+dir path=usr/lib/cups/startup
 dir path=usr/lib/gutenprint
 dir path=usr/lib/gutenprint/5.2
 dir path=usr/lib/gutenprint/5.2/modules
@@ -144,6 +145,8 @@
 file path=usr/lib/cups/filter/commandtocanon
 file path=usr/lib/cups/filter/commandtoepson
 file path=usr/lib/cups/filter/rastertogutenprint.5.2
+file gutenprint.startup path=usr/lib/cups/startup/gutenprint \
+     restart_fmri=svc:/application/cups/scheduler:default
 file path=usr/lib/gutenprint/5.2/modules/color-traditional.so
 file path=usr/lib/gutenprint/5.2/modules/print-canon.so
 file path=usr/lib/gutenprint/5.2/modules/print-dyesub.so
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gutenprint/gutenprint.startup	Thu May 10 22:29:43 2012 -0700
@@ -0,0 +1,50 @@
+#!/usr/bin/sh
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+#
+# This script should be run from the CUPS scheduler service start method.
+#
+# usage: /usr/lib/cups/startup/gutenprint <fmri> <pg/prop>
+#
+# where: <fmri>    ... FMRI of the CUPS scheduler service
+#        <pg/prop> ... property group/name where to store status
+#
+
+SVC=$1
+PROP=$2
+
+# verify input arguments
+if [ -z "$SVC" -o -z "$PROP" ] ; then
+	echo "$0: Invalid arguments."
+	echo "usage: $0 <fmri> <pg/prop>"
+	exit 1
+fi
+
+# determine the package version
+VER=`pkg search -Hlo pkg.fmri "$0" | cut -d @ -f 2`
+if [ -z "$VER" ] ; then
+	echo "$0: Failed to read package version."
+	exit 1
+fi
+
+# read the value of status property, if it exists
+if svcprop -q -p "$PROP" "$SVC" ; then
+	VAL=`svcprop -p "$PROP" "$SVC"`
+fi
+
+# compare the value with package version
+if [ "$VAL" = "$VER" ] ; then
+	# PPD files already updated for this package version
+	exit 0
+fi
+
+# update PPD files
+if ! /usr/sbin/cups-genppdupdate ; then
+	echo "$0: Failed to update PPD files."
+	exit 1
+fi
+
+# store status into the SMF repository
+svccfg -s "$SVC" setprop "$PROP" = astring: "$VER"
+
+exit 0