Ticket #14615: select.diff
File select.diff, 1.7 KB (added by blb@…, 16 years ago) |
---|
-
select/select.sh
37 37 TOOL=${NAME}_select 38 38 CONFPATH=${PREFIX}/etc/select/${NAME} 39 39 VERSION=__VERSION__ 40 SELECTEDVERSION=${CONFPATH}/.current 40 41 41 42 42 43 ## GLOBALS … … 67 68 -v Display version of ${TOOL}. 68 69 -l List available options for version. 69 70 -i path Install mode to perform an initial selection in path. 71 -s Show the currently selected version 70 72 71 73 EOD 72 74 } … … 82 84 echo $(ls -1 ${CONFPATH} | grep -v base) 83 85 } 84 86 87 # list the currently selected version 88 list_current_selection() { 89 if [ -e ${SELECTEDVERSION} ]; then 90 cat ${SELECTEDVERSION} 91 else 92 echo "none" 93 fi 94 } 95 85 96 # test if a particular version is available 86 97 version_is_valid() { 87 98 for version in $(ls -1 ${CONFPATH} | grep -v base); do … … 118 129 local i=1 119 130 local empty=0 120 131 echo "Selecting version \"${1}\" for ${NAME}" 132 if [ 1 == ${noexec} ]; then 133 echo "echo ${1} >| ${SELECTEDVERSION}" 134 else 135 echo ${1} >| ${SELECTEDVERSION} 136 fi 121 137 for target in $(cat ${CONFPATH}/base); do 122 138 src=$(head -n ${i} ${CONFPATH}/${1} | tail -n 1) 123 139 … … 146 162 fi 147 163 148 164 # parse command line args 149 args=$(/usr/bin/getopt i:fhndlr v $*)165 args=$(/usr/bin/getopt i:fhndlrsv $*) 150 166 set -- ${args} 151 167 for i; do 152 168 case "${i}" in … … 166 182 version; exit 0;; 167 183 -i) 168 184 inst_mode=1; DESTDIR=${2}; shift; shift;; 185 -s) 186 list_current_selection; exit 0;; 169 187 --) 170 188 shift; break;; 171 189 esac … … 180 198 if [ "1" = "${inst_mode}" ]; then 181 199 echo "install mode: destroot: \"${DESTDIR}\"" 182 200 CONFPATH=${DESTDIR}${CONFPATH} 201 SELECTEDVERSION=${CONFPATH}/.current 183 202 select_version ${1} 184 203 exit ${?} 185 204 fi