--- trunk/mage/usr/lib/mage/mage4.sh 2005/10/03 13:48:06 254 +++ trunk/mage/usr/lib/mage/mage4.sh 2010/06/28 17:45:18 1080 @@ -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.8 2005-10-03 13:48:06 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,19 +15,13 @@ 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 || \ die "mage functions missing" -# for tests only -#source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global -#source /etc/mage.rc -#source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh -#MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage - ## only for tests -> normally in /etc/rc.d/init.d/functions COLRED="\033[1;6m\033[31m" COLGREEN="\033[1;6m\033[32m" @@ -60,7 +55,7 @@ # sanity checks [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} -if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] +if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]] then echo echo "Please choose an profile from the mage tree." @@ -69,42 +64,46 @@ fi # default messages -showversion() { +showversion() +{ local MAGEVERSION="$(< ${MLIBDIR}/version)" echo -en "Magellan Package Manager v${MAGEVERSION} " echo -e "-- Niels Rogalla (niro@magellan-linux.de)" } -print_usage(){ - showversion - echo +print_usage() +{ + #showversion + #echo echo "Usage: $(basename $0) [option] pkgname ..." echo "Options:" - echo " pretend - pretends dependencies of a package" - echo " srcpretend - pretends dependencies of a package (build from source)" - echo " install - installs a package" - echo " srcinstall - installs a package from source" - echo " uninstall - removes a package" - echo " update - updates mage-tree" - 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 " search - searches mage-tree for a package" - echo " clean - removes *all* downloaded packages" - echo " unpack - unpacks *all* needed package for 'foo'" - echo " download - downloads *all* needed packages for 'foo'" - echo " version - prints version info" + echo " pretend - pretends dependencies of a package" + echo " srcpretend - pretends dependencies of a package (build from source)" + 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-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 " search - searches mage-tree for a package" + echo " clean - removes *all* downloaded packages" + echo " unpack - unpacks *all* needed package for 'foo'" + echo " download - downloads *all* needed packages for 'foo'" + echo " version - prints version info" + echo " regen-mage-tree - regenerates the whole mage database (for devs only)" echo echo "Other options:" # echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" # echo "Builds a Package with its dependencies, but won't install anything." # echo - echo "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE" + echo "MAGE_DISTRIBUTION=unstable $(basename $0) [src]install PACKAGE" echo "Overrides stable packages; you can install packages that are marked unstable." echo - echo "USE_TESTING=true $(basename $0) [src]install PACKAGE" + echo "MAGE_DISTRIBUTION=testing $(basename $0) [src]install PACKAGE" echo "Overrides stable packages; you can install packages that are marked testing." echo echo "NOCOLORS=true $(basename $0) [src]install PACKAGE" @@ -116,9 +115,6 @@ showversion echo -# before anything run mage_setup -mage_setup || die "error in mage_setup()" - # install method METHOD="$1" @@ -130,6 +126,7 @@ [[ ${METHOD} != uppretend ]] && \ [[ ${METHOD} != srcuppretend ]] && \ [[ ${METHOD} != update ]] && \ + [[ ${METHOD} != update-tarball ]] && \ [[ ${METHOD} != clean ]] && \ [[ ${METHOD} != version ]] && \ [[ ${METHOD} != search ]] && \ @@ -138,6 +135,15 @@ [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 fi +# set PKGDIR and BUILDDIR to MROOT +if [[ -n ${MROOT} ]] +then + PKGDIR=${MROOT}/${PKGDIR} + BUILDDIR=${MROOT}/${BUILDDIR} +fi + +# before anything run mage_setup +mage_setup || die "error in mage_setup()" case ${METHOD} in download) @@ -150,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})" @@ -177,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})" @@ -203,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})" @@ -236,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})" @@ -275,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})" @@ -362,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})" @@ -384,12 +408,17 @@ syncmage ;; + update-tarball) + syncmage_tarball + ;; + clean) cleanpkg ;; version) - showversion + # showversion + exit 0 ;; regen-mage-tree)