--- trunk/mage/usr/lib/mage/mage4.sh 2013/10/16 07:40:02 2221 +++ trunk/mage/usr/lib/mage/mage4.sh 2014/01/06 12:31:51 2358 @@ -1,11 +1,12 @@ #!/bin/bash # Magellan Linux Installer (mage.sh) -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.17 2008-06-16 09:29:57 niro Exp $ +# $Id$ # default die function die() { - echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} + xtitleclean + mqueryfeature "debug" && echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} echo -e ${COLRED}"$@"${COLDEFAULT} exit 1 } @@ -31,7 +32,10 @@ # sanity checks [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} -if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]] +if [ ! -e ${VIRTUALDB_DEFAULTS} ] && + [[ $1 != update ]] && + [[ $1 != update-rsync ]] && + [[ $1 != update-tarball ]] then echo echo "Please choose an profile from the mage tree." @@ -59,14 +63,15 @@ echo " install - installs a package" echo " srcinstall - installs a package from source" echo " uninstall - removes a package" - echo " update - updates the mage-tree via rsync" + echo " update - updates the mage-tree via default sync method" + echo " update-rsync - 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" echo " srcupgrade - runs a complete system upgrade from source" - echo " pretend-build-prerequisites" - echo " install-build-prerequisites" + echo " pretend-build-prerequisites - prints build prerequisites" + echo " install-build-prerequisites - install build prerequisites" echo " search - searches mage-tree for a package" echo " clean - removes *all* downloaded packages" echo " unpack - unpacks *all* needed package for 'foo'" @@ -105,6 +110,7 @@ [[ ${METHOD} != uppretend ]] && [[ ${METHOD} != srcuppretend ]] && [[ ${METHOD} != update ]] && + [[ ${METHOD} != update-rsync ]] && [[ ${METHOD} != update-tarball ]] && [[ ${METHOD} != clean ]] && [[ ${METHOD} != version ]] && @@ -138,6 +144,8 @@ case ${METHOD} in download) + have_root_privileges || die "You must be root to run this operation." + # first of all get the right pkg which going to be installed PCAT="$(pname2pcat ${MAGENAME})" @@ -169,6 +177,8 @@ ;; srcdownload) + have_root_privileges || die "You must be root to run this operation." + # first of all get the right pkg which going to be installed PCAT="$(pname2pcat ${MAGENAME})" @@ -417,6 +427,17 @@ update) have_root_privileges || die "You must be root to run this operation." + # default to tarball + [[ -z ${MAGE_UPDATE_METHOD} ]] && MAGE_UPDATE_METHOD="tarball" + case ${MAGE_UPDATE_METHOD} in + rsync) syncmage ;; + tarball) syncmage_tarball ;; + *) die "Unknown MAGE_UPDATE_METHOD defined." ;; + esac + ;; + + update-rsync) + have_root_privileges || die "You must be root to run this operation." syncmage ;;