--- trunk/mage/usr/lib/mage/mage4.functions.sh 2006/08/27 19:17:14 391 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2007/06/30 15:31:46 499 @@ -1,6 +1,6 @@ #!/bin/bash # Magellan Linux Installer Functions (mage.functions.sh) -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.22 2006-08-27 19:17:14 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.32 2007-06-30 15:31:46 niro Exp $ mage_setup() { @@ -1106,7 +1106,7 @@ local count_current local count_total - [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your /etc/mage.rc." + [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}." # get count of total packages declare -i count_current=0 @@ -1181,7 +1181,7 @@ { if [ -z "${RSYNC}" ] then - die "You have no rsync-mirrors defined. Please edit your /etc/mage.rc." + die "You have no rsync-mirrors defined. Please edit your ${MAGERC}." fi local i @@ -1240,7 +1240,7 @@ if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] then #cuts ARCH and PBUILD - #ARCH comes from /etc/mage.rc + #ARCH comes from ${MAGERC} MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") #cuts version number @@ -1375,7 +1375,7 @@ EXPFILE="${MROOT}$1" # file does not exist; it can be written - [ ! -e ${EXPFILE} ] && return 0 + [[ ! -e ${EXPFILE} ]] && return 0 # to be safe; it may be '§' IFS=' ' @@ -1385,7 +1385,7 @@ do # ersetzen von $i nur wenn am anfang der variable TEST="${EXPFILE/#${MROOT}${i}/Protected}" - if [ "${TEST}" != "${EXPFILE}" ] + if [[ ${TEST} != ${EXPFILE} ]] then # setzen das es protected ist PROTECTED=TRUE @@ -1394,7 +1394,7 @@ for x in ${CONFIG_PROTECT_MASK} do TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}" - if [ "${TEST}" != "${EXPFILE}" ] + if [[ ${TEST} != ${EXPFILE} ]] then PROTECTED=MASKED fi @@ -1447,6 +1447,7 @@ local list local pcatdir local protected + local i # very basic getops for i in $* @@ -1708,9 +1709,9 @@ { local i - if [ -n "$@" ] + if [[ -n $* ]] then - for i in $@ + for i in $* do [[ ${MAGEDEBUG} = on ]] && \ echo "--- Including ${MAGEDIR}/include/${i}.minc" @@ -1724,9 +1725,9 @@ { local i - if [ -n "$@" ] + if [[ -n $* ]] then - for i in $@ + for i in $* do echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc" source ${SMAGESCRIPTSDIR}/include/${i}.sminc @@ -2339,7 +2340,7 @@ echo -ne "${COLBLUE} --- ${COLDEFAULT}" echo -ne "${COLBOLD}${can_pcat}/${can_pname}:${COLDEFAULT}" echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}" - echo + echo [04] app-emulation/virtualbox-1.4.0-r3 if [ ${MAGE_UNINSTALL_TIMEOUT} -gt 0 ] then echo -ne "${COLBLUE} --- ${COLDEFAULT}" @@ -2405,19 +2406,19 @@ for i in $* do case $1 in - --pcat|-c) shift; pcat="$1" ;; + --pcat|-c) shift; pcat="$1" ;; [04] app-emulation/virtualbox-1.4.0-r3 --pname|-n) shift; pname="$1" ;; --pver|-v) shift; pver="$1" ;; - --pbuild|-b) shift; pbuild="$1" ;; + --pbuild|-b) shift; pbuild="$1" ;; [04] app-emulation/virtualbox-1.4.0-r3 esac shift - done + done [04] app-emulation/virtualbox-1.4.0-r3 # sanity checks; abort if not given - [ -z "${pcat}" ] && die "mage_uninstall() \$pcat not given." + [ -z "${pcat}" ] && die "mage_uninstall() \$pcat not given." [04] app-emulation/virtualbox-1.4.0-r3 [ -z "${pname}" ] && die "mage_uninstall() \$pname not given." [ -z "${pver}" ] && die "mage_uninstall() \$pver not given." - [ -z "${pbuild}" ] && die "mage_uninstall() \$pbuild not given." + [ -z "${pbuild}" ] && die "mage_uninstall() \$pbuild not given." [04] app-emulation/virtualbox-1.4.0-r3 # check needed global vars [ -z "${MAGEDIR}" ] && die "mage_uninstall() \$MAGEDIR not set." @@ -2428,9 +2429,9 @@ echo -ne "${COLBLUE} <<< ${COLDEFAULT}" echo -n "removing: " echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}" - echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}" + echo -e "${COLRED}${pname}-${pver}-${pbuild}${COLDEFAULT}" - magefile="${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage" + magefile="${MROOT}${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage" source ${magefile} ## preremove scripts @@ -2528,6 +2529,13 @@ local all_installed local ipver local ipbuild + local latest_available + local depsfull + local sdepsfull + local deps + local sdeps + local dep + local sign # only names no versions result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name '*'${string}'*'| sed '/profiles/d' | sed '/includes/d')" @@ -2545,40 +2553,76 @@ # get highest version available magefile=$(get_highest_magefile ${pcat} ${pname}) - # now get all needed infos to print a nice output - pver="$(magename2pver ${magefile})" - pbuild="$(magename2pbuild ${magefile})" - state="$(get_value_from_magefile STATE ${magefile})" - description="$(get_value_from_magefile DESCRIPTION ${magefile})" - homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" + if [[ ! -z ${magefile} ]] + then + # now get all needed infos to print a nice output + pver="$(magename2pver ${magefile})" + pbuild="$(magename2pbuild ${magefile})" + state="$(get_value_from_magefile STATE ${magefile})" + description="$(get_value_from_magefile DESCRIPTION ${magefile})" + homepage="$(get_value_from_magefile HOMEPAGE ${magefile})" + + # all installed + for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) + do + ipver="$(magename2pver ${i})" + ipbuild="$(magename2pbuild ${i})" + + if [[ -z ${all_installed} ]] + then + all_installed="${ipver}-${ipbuild}" + else + all_installed="${all_installed} ${ipver}-${ipbuild}" + fi + done + [[ -z ${all_installed} ]] && all_installed="none" + + case ${state} in + stable) state=${COLGREEN}"[s] ";; + testing) state=${COLYELLOW}"[t] ";; + unstable) state=${COLRED}"[u] ";; + old) state=${COLGRAY}"[o] ";; + esac + + latest_available="${pver}-${pbuild}" + else + # package is masked + state="${COLRED}[m] " + latest_available="${COLRED}masked for this distribution.${COLDEFAULT}" + fi - # all installed - for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat}) - do - ipver="$(magename2pver ${i})" - ipbuild="$(magename2pbuild ${i})" + depsfull="$(get_value_from_magefile DEPEND ${magefile})" + sdepsfull="$(get_value_from_magefile SDEPEND ${magefile})" - if [[ -z ${all_installed} ]] - then - all_installed="${ipver}-${ipbuild}" - else - all_installed="${all_installed} ${ipver}-${ipbuild}" - fi - done - [[ -z ${all_installed} ]] && all_installed="none" + while read sign dep + do + case ${dep} in + "") continue;; + esac + + deps="${deps} $(basename ${dep%-*})" + done << EOF +${depsfull} +EOF - case ${state} in - stable) state=${COLGREEN}"[s] ";; - testing) state=${COLYELLOW}"[t] ";; - unstable) state=${COLRED}"[u] ";; - old) state=${COLGRAY}"[o] ";; - esac + while read sign dep + do + case ${dep} in + "") continue;; + esac + + sdeps="${sdeps} $(basename ${dep%-*})" + done << EOF +${sdepsfull} +EOF echo -e "${state}${pcat}/${pname}"${COLDEFAULT} - echo " Latest available: ${pver}-${pbuild}" + echo -e " Latest available: ${latest_available}" echo " Installed versions: ${all_installed}" echo " Description: ${description}" echo " Homepage: ${homepage}" + echo " Depends: ${deps}" + echo " SDepends: ${sdeps}" echo unset pcat @@ -2592,6 +2636,12 @@ unset all_installed unset ipver unset ipbuild + unset depsfull + unset sdepsfull + unset deps + unset sdeps + unset dep + unset sign done }