[csw-maintainers] cswinitsmf and alternate root's

Jan Holzhueter jh at opencsw.org
Thu Jul 26 16:19:10 CEST 2012


Hi,
see inline:

Am 26.07.12 16:07, schrieb Ben Walton:

> Index: CSWcswclassutils.i.cswinitsmf
> ===================================================================
> --- CSWcswclassutils.i.cswinitsmf	(revision 18857)
> +++ CSWcswclassutils.i.cswinitsmf	(working copy)
> @@ -23,6 +23,7 @@
>  # 2009-08-10 Fix autoenable bug (Bug ID 0003785)
>  # 2010-10-25 Fix grep bug in FMRI 'dot in name' detection (Bug ID 0004588)
>  # 2011-04-21 Read absolute state value instead of defaulting to enabled
> +# 2012-07-26 Better handle -R (alt root) for BE patching, etc. -bw
>  
>  DEBUG=		# clear to disable debug, set to anything to enable
>  SVCDIR=/var/opt/csw/svc
> @@ -110,11 +111,11 @@
>      testpath=$SVCDIR/manifest
>      for i in `echo $FMRI | sed 's/\// /g'`; do
>        testpath=$testpath/$i
> -      if [ ! -d $testpath ]; then
> +      if [ ! -d $PKG_INSTALL_ROOT/$testpath ]; then
>          echo Creating $testpath ...
> -        /usr/bin/mkdir $testpath
> -        /usr/bin/chown root:bin $testpath
> -        /usr/bin/chmod 755 $testpath
> +        /usr/bin/mkdir $PKG_INSTALL_ROOT/$testpath
> +        /usr/bin/chown root:bin $PKG_INSTALL_ROOT/$testpath
> +        /usr/bin/chmod 755 $PKG_INSTALL_ROOT/$testpath
>          /usr/sbin/installf -c cswinitsmf $PKGINST $testpath d 755 root bin
>        fi
>      done
> @@ -122,10 +123,10 @@
>        echo FMRI: $FMRI
>      fi
>      echo Creating service script in $SVCDIR/method/svc-$service ...
> -    /usr/bin/ln -s $dest $SVCDIR/method/svc-$service
> +    /usr/bin/ln -s $dest $PKG_INSTALL_ROOT/$SVCDIR/method/svc-$service
>      /usr/sbin/installf -c cswinitsmf $PKGINST $SVCDIR/method/svc-$service=$dest s
> -    /usr/bin/chmod 755 $SVCDIR/method/svc-$service
> -    /usr/bin/chown root:bin $SVCDIR/method/svc-$service
> +    /usr/bin/chmod 755 $PKG_INSTALL_ROOT/$SVCDIR/method/svc-$service
> +    /usr/bin/chown root:bin $PKG_INSTALL_ROOT/$SVCDIR/method/svc-$service
>  
>      MANIFEST=
>      if [ "`grep '^#MANIFEST' $dest`" ]; then
> @@ -136,7 +137,7 @@
>        echo Creating manifest ...
>        # Add first part of manifest
>        MANIFEST=$SVCDIR/manifest/$FMRI/$service.xml
> -      cat > $MANIFEST << EOF
> +      cat > $PKG_INSTALL_ROOT/$MANIFEST << EOF
>  <?xml version='1.0'?>
>  <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
>  <!--
> @@ -185,8 +186,8 @@
>  EOF
>  
>        # Add restart option to manifest if service script supports it
> -      if [ "`/usr/bin/egrep 'restart.?\)' $SVCDIR/method/svc-$service`" ]; then
> -        cat >> $MANIFEST << EOF
> +      if [ "`/usr/bin/egrep 'restart.?\)' $PKG_INSTALL_ROOT/$SVCDIR/method/svc-$service`" ]; then
> +        cat >> $PKG_INSTALL_ROOT/$MANIFEST << EOF
>    <exec_method
>      type='method'
>      name='restart'
> @@ -198,8 +199,8 @@
>        fi
>  
>        # Add refresh option to manifest if service script supports it
> -      if [ "`/usr/bin/egrep 'refresh.?\)' $SVCDIR/method/svc-$service`" ]; then
> -        cat >> $MANIFEST << EOF
> +      if [ "`/usr/bin/egrep 'refresh.?\)' $PKG_INSTALL_ROOT/$SVCDIR/method/svc-$service`" ]; then
> +        cat >> $PKG_INSTALL_ROOT/$MANIFEST << EOF
>    <exec_method
>      type='method'
>      name='refresh'
> @@ -211,14 +212,14 @@
>        fi
>  
>        # Add last part of manifest
> -      cat >> $MANIFEST << EOF
> +      cat >> $PKG_INSTALL_ROOT/$MANIFEST << EOF
>  </service>
>  
>  </service_bundle>
>  EOF
>        /usr/sbin/installf -c cswinitsmf $PKGINST $MANIFEST f 644 root bin
> -      /usr/bin/chmod 644 $MANIFEST
> -      /usr/bin/chown root:bin $MANIFEST
> +      /usr/bin/chmod 644 $PKG_INSTALL_ROOT/$MANIFEST
> +      /usr/bin/chown root:bin $PKG_INSTALL_ROOT/$MANIFEST
>      else
>        # Custom manifest
>        echo Using custom manifest ...
> @@ -230,8 +231,10 @@
>  
>      # Register with SMF
>      echo Configuring service in SMF ...
> -    /usr/sbin/svccfg import $MANIFEST > /dev/null 2>&1
> -    /usr/sbin/svcadm disable svc:/$FMRI/$service > /dev/null 2>&1
> +    chroot ${PKG_INSTALL_ROOT:-/} /usr/sbin/svccfg import $MANIFEST > /dev/null 2>&1
> +    if [ "${PKG_INSTALL_ROOT:-/}" != "/" ]; then
> +	/usr/sbin/svcadm disable svc:/$FMRI/$service > /dev/null 2>&1
> +    fi
>      echo $PKGINST is using Service Management Facility. The FMRI is svc:/$FMRI/$service:default


I'm not sure if this works.
Can you import a manifest without the smf service running the in BE?

Greetings
Jan




More information about the maintainers mailing list