--- trunk/mage/usr/lib/mage/mage4.sh 2012/03/12 23:21:12 1780 +++ 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,12 +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 - 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'" @@ -103,6 +110,7 @@ [[ ${METHOD} != uppretend ]] && [[ ${METHOD} != srcuppretend ]] && [[ ${METHOD} != update ]] && + [[ ${METHOD} != update-rsync ]] && [[ ${METHOD} != update-tarball ]] && [[ ${METHOD} != clean ]] && [[ ${METHOD} != version ]] && @@ -126,8 +134,18 @@ # load supported mage features load_mage_features +# query debug mode +if mqueryfeature "debug" +then + depwalker_debug="--debug" +else + depwalker_debug="" +fi + 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})" @@ -152,12 +170,15 @@ --pcat ${PCAT} \ --pname ${PNAME} \ --pver ${PVER} \ - --pbuild ${PBUILD})" + --pbuild ${PBUILD} \ + ${depwalker_debug})" fetch_packages ${ALLDEPS} || die "fetching packages" md5sum_packages ${ALLDEPS} || die "md5 sum packages" ;; 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})" @@ -182,11 +203,12 @@ --pcat ${PCAT} \ --pname ${PNAME} \ --pver ${PVER} \ - --pbuild ${PBUILD})" + --pbuild ${PBUILD} \ + ${depwalker_debug})" fetch_packages ${ALLDEPS} || die "fetching packages" ;; - pretend|srcpretend) + pretend|srcpretend|pretend-build-prerequisites) # first of all get the right pkg which going to be installed PCAT="$(pname2pcat ${MAGENAME})" @@ -219,10 +241,11 @@ --pcat ${PCAT} \ --pname ${PNAME} \ --pver ${PVER} \ - --pbuild ${PBUILD} + --pbuild ${PBUILD} \ + ${depwalker_debug} ;; - install) + install|install-build-prerequisites) have_root_privileges || die "You must be root to run this operation." # first of all get the right pkg which going to be installed @@ -257,12 +280,12 @@ --pcat ${PCAT} \ --pname ${PNAME} \ --pver ${PVER} \ - --pbuild ${PBUILD})" + --pbuild ${PBUILD} \ + ${depwalker_debug})" # first fetch all packages fetch_packages ${ALLDEPS} || die "fetching packages" md5sum_packages ${ALLDEPS} || die "md5 sum packages" - unpack_packages ${ALLDEPS} || die "unpacking packages" install_packages ${ALLDEPS} || die "installing packages" ;; @@ -301,7 +324,8 @@ --pcat ${PCAT} \ --pname ${PNAME} \ --pver ${PVER} \ - --pbuild ${PBUILD})" + --pbuild ${PBUILD} \ + ${depwalker_debug})" install_packages --src-install ${ALLDEPS} || die "src-installing packages" ;; @@ -323,7 +347,8 @@ --pcat ${METHOD} \ --pname ${METHOD} \ --pver ${METHOD} \ - --pbuild ${METHOD} + --pbuild ${METHOD} \ + ${depwalker_debug} ;; upgrade) @@ -336,12 +361,12 @@ --pcat ${METHOD} \ --pname ${METHOD} \ --pver ${METHOD} \ - --pbuild ${METHOD})" + --pbuild ${METHOD} \ + ${depwalker_debug})" # first fetch all packages fetch_packages ${ALLDEPS} || die "fetching packages" md5sum_packages ${ALLDEPS} || die "md5 sum packages" - unpack_packages ${ALLDEPS} || die "unpacking packages" install_packages ${ALLDEPS} || die "installing packages" ;; @@ -355,7 +380,8 @@ --pcat ${METHOD} \ --pname ${METHOD} \ --pver ${METHOD} \ - --pbuild ${METHOD})" + --pbuild ${METHOD} \ + ${depwalker_debug})" install_packages --src-install ${ALLDEPS} || die "src-installing packages" ;; @@ -391,7 +417,9 @@ --pcat ${PCAT} \ --pname ${PNAME} \ --pver ${PVER} \ - --pbuild ${PBUILD})" + --pbuild ${PBUILD} \ + ${depwalker_debug})" + fetch_packages ${ALLDEPS} || die "fetching packages" md5sum_packages ${ALLDEPS} || die "md5 sum packages" unpack_packages ${ALLDEPS} || die "unpacking packages" @@ -399,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 ;;