--- trunk/mage/usr/lib/mage/mage4.sh 2005/12/04 12:02:21 295 +++ trunk/mage/usr/lib/mage/mage4.sh 2008/06/16 09:29:57 739 @@ -1,10 +1,11 @@ #!/bin/sh # Magellan Linux Installer (mage.sh) -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.10 2005-12-04 12:02:21 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.17 2008-06-16 09:29:57 niro Exp $ # default die function die() { + echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} echo -e ${COLRED}"$@"${COLDEFAULT} exit 1 } @@ -14,8 +15,8 @@ source /etc/mage.rc.global || \ die "/etc/mage.rc.global missing" -[ -f /etc/mage.rc ] && source /etc/mage.rc || \ - die "Your /etc/mage.rc is missing. Aborting." +[ -f ${MAGERC} ] && source ${MAGERC} || \ + die "Your ${MAGERC} is missing. Aborting." [ -f ${MLIBDIR}/mage4.functions.sh ] && \ source ${MLIBDIR}/mage4.functions.sh || \ @@ -73,8 +74,8 @@ print_usage() { - showversion - echo + #showversion + #echo echo "Usage: $(basename $0) [option] pkgname ..." echo "Options:" echo " pretend - pretends dependencies of a package" @@ -82,7 +83,8 @@ echo " install - installs a package" echo " srcinstall - installs a package from source" echo " uninstall - removes a package" - echo " update - updates mage-tree" + echo " update - updates the mage-tree via rsync" + echo " update-tarball - updates the mage-tree via a tarball" echo " uppretend - pretend dependencies for a system upgrade" echo " upgrade - runs a complete system upgrade" echo " srcuppretend - pretend dependencies for a system upgrade from source" @@ -113,9 +115,6 @@ showversion echo -# before anything run mage_setup -mage_setup || die "error in mage_setup()" - # install method METHOD="$1" @@ -127,6 +126,7 @@ [[ ${METHOD} != uppretend ]] && \ [[ ${METHOD} != srcuppretend ]] && \ [[ ${METHOD} != update ]] && \ + [[ ${METHOD} != update-tarball ]] && \ [[ ${METHOD} != clean ]] && \ [[ ${METHOD} != version ]] && \ [[ ${METHOD} != search ]] && \ @@ -142,6 +142,9 @@ BUILDDIR=${MROOT}/${BUILDDIR} fi +# before anything run mage_setup +mage_setup || die "error in mage_setup()" + case ${METHOD} in download) # first of all get the right pkg which going to be installed @@ -153,6 +156,9 @@ # source the highest magefile of this pkg PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) + # package is masked + [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." + # convert PKGNAME to PNAME/PVER/PBUILD # we're working *only* with these three vars from here on PNAME="$(pkgname2pname ${PKGNAME})" @@ -180,6 +186,9 @@ # source the highest magefile of this pkg PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) + # package is masked + [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." + # convert PKGNAME to PNAME/PVER/PBUILD # we're working *only* with these three vars from here on PNAME="$(pkgname2pname ${PKGNAME})" @@ -206,6 +215,9 @@ # source the highest magefile of this pkg PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) + # package is masked + [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." + # convert PKGNAME to PNAME/PVER/PBUILD # we're working *only* with these three vars from here on PNAME="$(pkgname2pname ${PKGNAME})" @@ -239,6 +251,9 @@ # source the highest magefile of this pkg PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) + # package is masked + [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." + # convert PKGNAME to PNAME/PVER/PBUILD # we're working *only* with these three vars from here on PNAME="$(pkgname2pname ${PKGNAME})" @@ -278,6 +293,9 @@ # source the highest magefile of this pkg PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) + # package is masked + [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." + # convert PKGNAME to PNAME/PVER/PBUILD # we're working *only* with these three vars from here on PNAME="$(pkgname2pname ${PKGNAME})" @@ -365,6 +383,9 @@ # source the highest magefile of this pkg PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) + # package is masked + [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." + # convert PKGNAME to PNAME/PVER/PBUILD # we're working *only* with these three vars from here on PNAME="$(pkgname2pname ${PKGNAME})" @@ -387,6 +408,10 @@ syncmage ;; + update-tarball) + syncmage_tarball + ;; + clean) cleanpkg ;;