Thu, 02 Aug 2012 22:07:29 +0200
Correct and update smf(5) logic to accommodate latest vendor version.
Support older and newer platforms by condtionally installing the
manifest to either /var/svc or cacnonical /lib/svc, and avoid usage of
svccfg(1) delete now considered risky. Leverage create_default_instance
smf macro to specify default instance instead of using instance element.
Provide a refresh execution method along with start and stop. Neither
change permissions of manifest nor call the redundant svcadm(1) disable.
openpkg/openpkg.spec | file | annotate | diff | comparison | revisions |
1.1 --- a/openpkg/openpkg.spec Thu Aug 02 01:49:00 2012 +0200 1.2 +++ b/openpkg/openpkg.spec Thu Aug 02 22:07:29 2012 +0200 1.3 @@ -2696,10 +2696,11 @@ 1.4 ;; 1.5 SunOS/5.1* ) 1.6 suname="`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`" 1.7 - if [ ! -d /var/svc/manifest/openpkg ]; then 1.8 - mkdir /var/svc/manifest/openpkg 1.9 + svcdir=/`[ -d /lib/svc/manifest ] && echo lib || echo var` 1.10 + if [ ! -d /${svcdir}/svc/manifest/openpkg ]; then 1.11 + mkdir /${svcdir}/svc/manifest/openpkg 1.12 fi 1.13 - if [ ! -f /var/svc/manifest/openpkg/${suname}.xml ]; then 1.14 + if [ ! -f /${svcdir}/svc/manifest/openpkg/${suname}.xml ]; then 1.15 # install SMF manifest 1.16 ( echo "<?xml version=\"1.0\"?>" 1.17 echo "<!DOCTYPE service_bundle SYSTEM \"/usr/share/lib/xml/dtd/service_bundle.dtd.1\">" 1.18 @@ -2708,6 +2709,7 @@ 1.19 echo " name='openpkg/${suname}'" 1.20 echo " type='service'" 1.21 echo " version='1'>" 1.22 + echo " <create_default_instance enabled='false' />" 1.23 echo " <single_instance />" 1.24 echo " <dependency" 1.25 echo " name='filesystem'" 1.26 @@ -2748,6 +2750,15 @@ 1.27 echo " </exec_method>" 1.28 echo " <exec_method" 1.29 echo " type='method'" 1.30 + echo " name='refresh'" 1.31 + echo " exec='${prefix}/etc/rc all restart'" 1.32 + echo " timeout_seconds='270'>" 1.33 + echo " <method_context>" 1.34 + echo " <method_credential user='root' group='root' />" 1.35 + echo " </method_context>" 1.36 + echo " </exec_method>" 1.37 + echo " <exec_method" 1.38 + echo " type='method'" 1.39 echo " name='stop'" 1.40 echo " exec='${prefix}/etc/rc all stop'" 1.41 echo " timeout_seconds='180'>" 1.42 @@ -2770,7 +2781,6 @@ 1.43 echo " type='astring'" 1.44 echo " value='solaris.smf.manage.openpkg.${suname}' />" 1.45 echo " </property_group>" 1.46 - echo " <instance name='default' enabled='false' />" 1.47 echo " <stability value='Unstable' />" 1.48 echo " <template>" 1.49 echo " <common_name>" 1.50 @@ -2779,10 +2789,9 @@ 1.51 echo " </template>" 1.52 echo " </service>" 1.53 echo "</service_bundle>" 1.54 - ) >/var/svc/manifest/openpkg/${suname}.xml 1.55 - chmod 644 /var/svc/manifest/openpkg/${suname}.xml 1.56 + ) >/${svcdir}/svc/manifest/openpkg/${suname}.xml 1.57 /usr/sbin/svcadm restart svc:/system/manifest-import 1.58 - ( echo "/usr/sbin/svcadm enable \"svc:/openpkg/${suname}:default\"" 1.59 + ( echo "/usr/sbin/svcadm enable svc:/openpkg/${suname}:default" 1.60 ) >%{l_prefix}.pre-post-process.sh 1.61 fi 1.62 ;; 1.63 @@ -3588,10 +3597,11 @@ 1.64 ;; 1.65 SunOS/5.1* ) 1.66 suname="`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`" 1.67 - /usr/sbin/svcadm disable "svc:/openpkg/${suname}:default"; sleep 2 1.68 - /usr/sbin/svccfg delete -f "svc:/openpkg/${suname}:default" >/dev/null 2>&1 || true 1.69 - rm -f /var/svc/manifest/openpkg/${suname}.xml >/dev/null 2>&1 1.70 - rmdir /var/svc/manifest/openpkg >/dev/null 2>&1 || true 1.71 + svcdir=/`[ -d /lib/svc/manifest ] && echo lib || echo var` 1.72 + /usr/sbin/svcadm disable svc:/openpkg/${suname}:default; sleep 2 1.73 + rm -f /${svcdir}/svc/manifest/openpkg/${suname}.xml >/dev/null 2>&1 1.74 + rmdir /${svcdir}/svc/manifest/openpkg >/dev/null 2>&1 || true 1.75 + /usr/sbin/svcadm restart svc:/system/manifest-import 1.76 ;; 1.77 SunOS/5.* ) 1.78 rm -f /etc/init.d/${name} >/dev/null 2>&1