--- trunk/mage/usr/lib/mage/mage4.functions.sh 2008/02/26 19:49:20 676 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2008/06/16 09:29:57 739 @@ -1,6 +1,6 @@ #!/bin/bash # Magellan Linux Installer Functions (mage.functions.sh) -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.36 2008-02-26 19:49:20 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.37 2008-06-16 09:29:27 niro Exp $ mage_setup() { @@ -1203,6 +1203,63 @@ is_newer_mage_version_available } +syncmage_tarball() +{ + local latest_tarball + local temp="$(mktemp -d)" + local mirr mymirr + + # try to get the tarball marked as latest on the server + latest_tarball="mage-latest.tar.bz2" + + for mirr in ${MIRRORS} + do + # path without distribution + mymirr="${mirr%/*}" + + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "fetching latest tarball from ${mymirr} ..." + + wget \ + --passive-ftp \ + --tries 3 \ + --continue \ + --progress bar \ + --directory-prefix=${temp} \ + ${mymirr}/rsync/tarballs/${latest_tarball} + if [[ $? = 0 ]] + then + break + else + continue + fi + done + + if [[ -f ${temp}/${latest_tarball} ]] + then + if [[ -d ${MAGEDIR} ]] + then + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "cleaning old mage-tree ${MAGEDIR}..." + rm -rf ${MAGEDIR} + fi + + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "updating mage-tree from tarball ..." + # unpack in dirname of MAGEDIR, as the tarball has already the mage + tar xjmf ${temp}/${latest_tarball} -C ${MAGEDIR%/*} || die "Unpacking tarball" + + if [[ -d ${temp} ]] + then + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "clenaing temp-files ..." + rm -rf ${temp} + fi + else + die "Could not fetch the latest tarball ... aborting" + fi +} + cleanpkg() { if [ -d "${PKGDIR}" ]