Ticket #14452: select.sh.diff
File select.sh.diff, 2.0 KB (added by ebgssth@…, 17 years ago) |
---|
-
select.sh
1 #!/bin/bash 1 #!/bin/bash -e 2 2 # 3 3 # $Id: portdestroot.tcl 27199 2007-07-24 09:09:43Z mww@macports.org $ 4 4 # … … 53 53 54 54 # print the usage of this tool 55 55 usage() { 56 echo "usage: ${TOOL} [-n] [-f] [-r] [-h] [-v] version" 57 echo "" 58 echo "-n Show commands to do selection but do not execute them." 59 echo "-f Ensure the links are correct for the specified version" 60 echo " even if it maches the current default version." 61 echo "-h Display this help info." 62 echo "-r Skip test for necessary rights." 63 echo "-v Display version of ${0}." 64 echo "-l List available options for version." 65 echo "-i path Install mode to perform an initial selection in path." 66 echo "" 56 cat <<EOD 57 usage: ${TOOL} [-n] [-f] [-r] [-h] [-v] version 58 59 -n Show commands to do selection but do not execute them. 60 -f Ensure the links are correct for the specified version 61 even if it maches the current default version. 62 -h Display this help info. 63 -r Skip test for necessary rights. 64 -v Display version of ${TOOL}. 65 -l List available options for version. 66 -i path Install mode to perform an initial selection in path. 67 68 EOD 67 69 } 68 70 69 71 # print the version of this tool … … 80 82 # test if a particular version is available 81 83 version_is_valid() { 82 84 for version in $(ls -1 ${CONFPATH} | grep -v base); do 83 if [ ${1} == ${version}]; then85 if [ "${1}" == "${version}" ]; then 84 86 return 0 85 87 fi 86 88 done … … 89 91 90 92 # perform an action (command) or just display it 91 93 action() { 92 if [ "rm" == ${1}]; then93 if [ 1 == ${noexec}]; then94 if [ "rm" == "${1}" ]; then 95 if [ 1 == "${noexec}" ]; then 94 96 echo "rm -f ${2}" 95 97 else 96 98 rm -f ${2} 97 99 fi 98 elif [ "ln" == ${1}]; then99 if [ 1 == ${noexec}]; then100 elif [ "ln" == "${1}" ]; then 101 if [ 1 == "${noexec}" ]; then 100 102 echo "ln -sf ${2} ${3}" 101 103 else 102 104 ln -sf ${2} ${3}