[40609] contrib/select/select.sh
raimue at macports.org
raimue at macports.org
Wed Oct 8 04:36:24 PDT 2008
Revision: 40609
http://trac.macports.org/changeset/40609
Author: raimue at macports.org
Date: 2008-10-08 04:36:23 -0700 (Wed, 08 Oct 2008)
Log Message:
-----------
contrib/select:
Apply patch from blb to save the current selected version, see #14615
Modified Paths:
--------------
contrib/select/select.sh
Modified: contrib/select/select.sh
===================================================================
--- contrib/select/select.sh 2008-10-08 09:25:54 UTC (rev 40608)
+++ contrib/select/select.sh 2008-10-08 11:36:23 UTC (rev 40609)
@@ -37,6 +37,7 @@
TOOL=${NAME}_select
CONFPATH=${PREFIX}/etc/select/${NAME}
VERSION=__VERSION__
+SELECTEDVERSION=${CONFPATH}/.current
## GLOBALS
@@ -67,6 +68,7 @@
-v Display version of ${TOOL}.
-l List available options for version.
-i path Install mode to perform an initial selection in path.
+-s Show the currently selected version
EOD
}
@@ -82,6 +84,15 @@
echo $(ls -1 ${CONFPATH} | grep -v base)
}
+# list the currently selected version
+list_current_selection() {
+ if [ -e ${SELECTEDVERSION} ]; then
+ cat ${SELECTEDVERSION}
+ else
+ echo "none"
+ fi
+}
+
# test if a particular version is available
version_is_valid() {
for version in $(ls -1 ${CONFPATH} | grep -v base); do
@@ -118,6 +129,11 @@
local i=1
local empty=0
echo "Selecting version \"${1}\" for ${NAME}"
+ if [ 1 == ${noexec} ]; then
+ echo "echo ${1} >| ${SELECTEDVERSION}"
+ else
+ echo ${1} >| ${SELECTEDVERSION}
+ fi
for target in $(cat ${CONFPATH}/base); do
src=$(head -n ${i} ${CONFPATH}/${1} | tail -n 1)
@@ -146,7 +162,7 @@
fi
# parse command line args
-args=$(/usr/bin/getopt i:fhndlrv $*)
+args=$(/usr/bin/getopt i:fhndlrsv $*)
set -- ${args}
for i; do
case "${i}" in
@@ -166,6 +182,8 @@
version; exit 0;;
-i)
inst_mode=1; DESTDIR=${2}; shift; shift;;
+ -s)
+ list_current_selection; exit 0;;
--)
shift; break;;
esac
@@ -180,6 +198,7 @@
if [ "1" = "${inst_mode}" ]; then
echo "install mode: destroot: \"${DESTDIR}\""
CONFPATH=${DESTDIR}${CONFPATH}
+ SELECTEDVERSION=${CONFPATH}/.current
select_version ${1}
exit ${?}
fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20081008/df44d5c6/attachment.html
More information about the macports-changes
mailing list