--- trunk/mage/usr/lib/mage/mage4.sh 2011/04/26 08:57:30 1269 +++ trunk/mage/usr/lib/mage/mage4.sh 2011/12/20 12:58:32 1541 @@ -242,6 +242,8 @@ ;; install) + 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})" @@ -284,6 +286,8 @@ ;; srcinstall) + 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})" @@ -322,12 +326,14 @@ ;; uninstall) - ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" - if [ -z "${ALLDEPS}" ] - then - die "No package installed named '${MAGENAME}'." - fi - uninstall_packages ${ALLDEPS} + have_root_privileges || die "You must be root to run this operation." + + ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" + if [ -z "${ALLDEPS}" ] + then + die "No package installed named '${MAGENAME}'." + fi + uninstall_packages ${ALLDEPS} ;; uppretend|srcuppretend) @@ -340,6 +346,8 @@ ;; upgrade) + have_root_privileges || die "You must be root to run this operation." + # get all dependencies of *all* installed packages # fake pcat,pname,pver,pbuild ... ALLDEPS="$(${MLIBDIR}/depwalker.sh \ @@ -357,6 +365,8 @@ ;; srcupgrade) + have_root_privileges || die "You must be root to run this operation." + # get all dependencies of *all* installed packages # fake pcat,pname,pver,pbuild ... ALLDEPS="$(${MLIBDIR}/depwalker.sh \ @@ -374,6 +384,8 @@ ;; unpack) + 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})" @@ -405,14 +417,17 @@ ;; update) + have_root_privileges || die "You must be root to run this operation." syncmage ;; update-tarball) + have_root_privileges || die "You must be root to run this operation." syncmage_tarball ;; clean) + have_root_privileges || die "You must be root to run this operation." cleanpkg ;; @@ -422,6 +437,8 @@ ;; regen-mage-tree) + have_root_privileges || die "You must be root to run this operation." + if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ] then echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos."