Having asked the question I wonder if perhaps the attached solution would be 
acceptable?

Basically it adds statements to postinstall which updates 
/var/svc/profile/upgrade
to create necessary svccfg commands which are then executed after the new 
manifest
has been imported.

Cheers, Stace
 
 
This message posted from opensolaris.org
-------------- next part --------------

------- usr/src/pkgdefs/SUNWbindr/postinstall -------

--- -   Wed Jan 10 18:28:18 2007
+++ usr/src/pkgdefs/SUNWbindr/postinstall       Wed Jan 10 18:27:51 2007
@@ -54,17 +54,73 @@
                 svcadm disable -s network/dns/server:bind9
                 svccfg delete network/dns/server:bind9
         fi
 _DEL_OBS_BIND9
 
-# Get rid of stale dependencies and start method
+# BIND 9.3.3 integration introduces smf_method(5) start script
+# Therefore need to upgrade each instance.
+cat >> $UPGRADE <<\_UPDATE_START_METHOD
+       svc="network/dns/server"
+       fupdate=/tmp/UPDATE_BIND
+       rm -f $fupdate
+       oset=$@
+       for inst in `svcs -H -o INST network/dns/server`
+       do
+         fopt=/tmp/UPDATE_BIND_OPT.$inst
+         rm -f $fopt
+         if fmri=`svcprop -p config_data/entities $svc:$inst`; then 
+             config=`echo $fmri | sed -e 's.file://localhost..'`
+             if [ $config != $fmri ]; then
+                 echo "setprop options/configuration_file=$config" >> $fopt
+             fi
+         fi
+
+         cmd=`svcprop -p start/exec $svc:$inst | sed -e 's/\\\\//g'`
+         
+         if [ ! -z "$cmd" ]; then
+             set -- $cmd
+             if [ "$1" != "/usr/sbin/named" ]; then
+                 # For backward compatability restore the current
+                 # exec string after import.
+                 echo "setprop start/exec=\"$cmd\"" >> $opt
+             fi
+             shift
+             while getopts :c:t:n:d:p:46 arg; do
+                 case $arg in
+                     c) echo "setprop options/configuration_file=$OPTARG" \
+                         >> $fopt;;
+                     t) echo "setprop options/chroot_dir=$OPTARG" \
+                         >> $fopt;;
+                     n) echo "setprop options/threads=$OPTARG" \
+                         >> $fopt;;
+                     d) echo "setprop options/debug_level=$OPTARG" \
+                         >> $fopt;;
+                     p) echo "setprop options/listen_on_port=$OPTARG" \
+                         >> $fopt;;
+                     4) echo "setprop options/ip_interfaces=IPv4" \
+                         >> $fopt;;
+                     6) echo "setprop options/ip_interfaces=IPv6" \
+                         >> $fopt;;
+                 esac
+             done
+         fi
+         if [ -f $fopt ]; then
+             echo "svccfg -s $svc:$inst -f $fopt" >> $fupdate
+             echo "rm $fopt" >> $fupdate
+         fi
+       done
+       # Restore previous command line args.
+       set -- $oset
+_UPDATE_START_METHOD
+
+# Get rid of stale dependencies
 smf_obs_pg network/dns/server usr
 smf_obs_pg network/dns/server config_data
 smf_obs_pg network/dns/server physical
 smf_obs_pg network/dns/server start
 
-cat >> $UPGRADE <<-EOF
+cat >> $UPGRADE <<\EOF
 
 # Delete the stale single_instance restriction, override the
 # common_name and re-import.
 if svcprop -q -p general/single_instance network/dns/server; then
        svccfg -s network/dns/server delprop general/single_instance
@@ -72,10 +128,15 @@
 if svcprop -q -p tm_common_name/C network/dns/server; then
        svccfg -s network/dns/server delprop tm_common_name/C
 fi
 svccfg import /var/svc/manifest/network/dns/server.xml
 svcadm refresh network/dns/server
+# If applicable set converted properties.
+if [ -f $fupdate ]; then
+       . $fupdate
+       svcadm refresh network/dns/server
+fi
 EOF
 
 #
 # Enable svc:/network/dns/server if requested.
 #

Reply via email to