[csw-devel] SF.net SVN: gar:[8498] csw/mgar/pkg/chkconfig/trunk

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Thu Feb 11 16:21:16 CET 2010


Revision: 8498
          http://gar.svn.sourceforge.net/gar/?rev=8498&view=rev
Author:   dmichelsen
Date:     2010-02-11 15:21:03 +0000 (Thu, 11 Feb 2010)

Log Message:
-----------
alternatives: Update CAS

Modified Paths:
--------------
    csw/mgar/pkg/chkconfig/trunk/checksums
    csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.i.cswalternatives
    csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.r.cswalternatives

Modified: csw/mgar/pkg/chkconfig/trunk/checksums
===================================================================
--- csw/mgar/pkg/chkconfig/trunk/checksums	2010-02-11 15:02:45 UTC (rev 8497)
+++ csw/mgar/pkg/chkconfig/trunk/checksums	2010-02-11 15:21:03 UTC (rev 8498)
@@ -1,7 +1,7 @@
 d56d4f7b5aef5af5235943c384734780  0001-Add-missing-include-to-alloca.h.patch
 a1045173b8bc0a667883080f85a38597  0002-Don-t-use-named-struct-initializers.patch
 5abe74bf8f38f45068f43f12b52cfc4b  0003-Fix-manpage-to-use-csw-pathes.patch
-9fcb33b563739c901979bee70a76fb69  CSWalternatives.i.cswalternatives
-918f71026f5ec5b08dcf138866f3979b  CSWalternatives.r.cswalternatives
+7acb4c811cecd886e010104270e6f2ff  CSWalternatives.i.cswalternatives
+9f2c7b5521878d39b4524588bf421eef  CSWalternatives.r.cswalternatives
 02019af22d048085f3006de791a0c95e  alloca.patch
 592a1fe77f3844d7748adbab6357ee25  chkconfig-1.3.30c.tar.gz

Modified: csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.i.cswalternatives
===================================================================
--- csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.i.cswalternatives	2010-02-11 15:02:45 UTC (rev 8497)
+++ csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.i.cswalternatives	2010-02-11 15:21:03 UTC (rev 8498)
@@ -7,6 +7,8 @@
 #
 # 2010-02-11 Initial release
 
+set -x
+
 : ${PKG_INSTALL_ROOT:=/}
 
 while read src dest; do
@@ -15,22 +17,36 @@
   cat $dest | while read C; do
     set -- $C
 
-    echo "Registering alternative $3 ..."
+    ALTLINK="$1"
+    ALTNAME="$2"
+    ALTPATH="$3"
+    ALTPRIO="$4"
 
-    A="--install $1 $2 $3 $4"
+    echo "Registering '$ALTNAME' alternative $ALTPATH ..."
+
+    ARGS="--install $ALTLINK $ALTNAME $ALTPATH $ALTPRIO"
     shift; shift; shift; shift
 
     while [ $# -gt 0 ]; do
-      A="$A --slave $1 $2 $3"
+      ARGS="$ARGS --slave $1 $2 $3"
       shift; shift; shift
     done
     
-    if [ -x ${PKG_INSTALL_ROOT}/opt/csw/sbin/alternatives ]; then
-      chroot ${PKG_INSTALL_ROOT} /opt/csw/sbin/alternatives $A
-    else
+    if [ ! -x ${PKG_INSTALL_ROOT}/opt/csw/sbin/alternatives ]; then
+      chroot ${PKG_INSTALL_ROOT} /opt/csw/sbin/alternatives $ARGS
       echo "ERROR: /opt/csw/sbin/alternatives could not be found" >&2
       exit 2
     fi
+
+    # Redo previous manual selection if this is an upgrade
+    if [ -L "${PKG_INSTALL_ROOT}/etc/opt/csw/preserve/CSWalternatives/alternatives/$ALTNAME" ]; then
+      CHOICE=`/usr/bin/perl -e 'print readlink $ARGV[0]' "${PKG_INSTALL_ROOT}/etc/opt/csw/preserve/CSWalternatives/alternatives/$ALTNAME"`
+      if [ "${CHOICE}" = "$ALTPATH" ]; then
+        echo "Applying previous manual selection ${CHOICE} ..."
+        chroot ${PKG_INSTALL_ROOT} /opt/csw/sbin/alternatives --set $ALTNAME ${CHOICE}
+        rm -f ${PKG_INSTALL_ROOT}/etc/opt/csw/preserve/CSWalternatives/alternatives/$ALTNAME
+      fi
+    fi
   done
 done
 

Modified: csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.r.cswalternatives
===================================================================
--- csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.r.cswalternatives	2010-02-11 15:02:45 UTC (rev 8497)
+++ csw/mgar/pkg/chkconfig/trunk/files/CSWalternatives.r.cswalternatives	2010-02-11 15:21:03 UTC (rev 8498)
@@ -7,14 +7,28 @@
 #
 # 2010-02-11 Initial release
 
+set -x
+
 : ${PKG_INSTALL_ROOT:=/}
 
 while read dest; do
   cat $dest | while read C; do
     set -- $C
 
-    echo "Unregistering alternative $3 ..."
+    # If we are in manual mode and the selected item is about to be removed
+    # make sure to remember the selection for next install to be reset.
 
+    if egrep '^manual$' ${PKG_INSTALL_ROOT}/var/opt/csw/alternatives/$2 >/dev/null 2>&1; then
+      CHOICE="`perl -e 'print readlink $ARGV[0]' ${PKG_INSTALL_ROOT}/etc/opt/csw/alternatives/$2`"
+      if [ "$3" = "${CHOICE}" ]; then
+        mkdir -p ${PKG_INSTALL_ROOT}/etc/opt/csw/preserve/CSWalternatives/alternatives
+        rm -f ${PKG_INSTALL_ROOT}/etc/opt/csw/preserve/CSWalternatives/alternatives/$2
+        ln -s "${CHOICE}" ${PKG_INSTALL_ROOT}/etc/opt/csw/preserve/CSWalternatives/alternatives/$2
+      fi
+    fi
+
+    echo "Unregistering '$2' alternative $3 ..."
+
     if [ -x ${PKG_INSTALL_ROOT}/opt/csw/sbin/alternatives ]; then
       chroot ${PKG_INSTALL_ROOT} /opt/csw/sbin/alternatives --remove $2 $3
     else


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list