[43715] contrib/select/select.sh

raimue at macports.org raimue at macports.org
Sat Dec 13 17:13:20 PST 2008


Revision: 43715
          http://trac.macports.org/changeset/43715
Author:   raimue at macports.org
Date:     2008-12-13 17:13:20 -0800 (Sat, 13 Dec 2008)
Log Message:
-----------
select:
Use a slightly different approach for 'current' target using symlinks.
This way, it is possible to repeat the last selection doing 'python_select current'.

Modified Paths:
--------------
    contrib/select/select.sh

Modified: contrib/select/select.sh
===================================================================
--- contrib/select/select.sh	2008-12-14 01:09:50 UTC (rev 43714)
+++ contrib/select/select.sh	2008-12-14 01:13:20 UTC (rev 43715)
@@ -37,7 +37,7 @@
 TOOL=${NAME}_select
 CONFPATH=${PREFIX}/etc/select/${NAME}
 VERSION=__VERSION__
-SELECTEDVERSION=${CONFPATH}/.current
+SELECTEDVERSION=${CONFPATH}/current
 
 
 ## GLOBALS
@@ -87,7 +87,7 @@
 # list the currently selected version
 list_current_selection() {
 	if [ -e ${SELECTEDVERSION} ]; then
-		cat ${SELECTEDVERSION}
+		readlink ${SELECTEDVERSION}
 	else
 		echo "none"
 	fi
@@ -129,9 +129,11 @@
 	local i=1
 	echo "Selecting version \"${1}\" for ${NAME}"
 	if [ 1 == ${noexec} ]; then
-		echo "echo ${1} >| ${SELECTEDVERSION}"
+		echo "ln -sf ${1} ${SELECTEDVERSION}"
 	else
-		echo ${1} >| ${SELECTEDVERSION}
+            if [ "${1}" != "current" ]; then
+		ln -sf ${1} ${SELECTEDVERSION}
+            fi
 	fi
 	for target in $(cat ${CONFPATH}/base); do
 		if [ "${1}" == "none" ]; then
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081213/5514dbf2/attachment.html>


More information about the macports-changes mailing list