Subversion Repositories ALCASAR

Rev

Rev 466 | Go to most recent revision | Blame | Last modification | View Log

#!/bin/sh
# $Id: alcasar-urpmi.sh 470 2011-01-30 22:11:12Z richard $
# script de mise à jour de la distribution 
# 3abtux & rexy
# changelog :
#       + Fait une mise à niveau du système actuel
#       + vérifie que la version actuelle du système est compatible 
#       + remplace les médias puis met à jour

VERSION="2010.1"
ARCH="i586"
# extract the current Mandriva version and hardware architecture (i586 ou X64)
fic=`cat /etc/product.id`
old="$IFS"
IFS=","
set $fic
for i in $*
do
        if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
        then 
                CURRENT_VERSION=`echo $i|cut -d"=" -f2`
                if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ] 
                then
                      echo "La migration automatique du système ne peut être réalisée."
                      echo "Réalisez une mise à jour manuelle (cf. doc)."
                      echo "The automatic system update can't perform."
                      echo "Do a manual update (see doc)."
                exit 1          
                fi
        fi
        if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
        then 
                ARCH=`echo $i|cut -d"=" -f2`
        fi
done
IFS="$old"
###########################
#                       For International install
#MIRRORLIST="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
#                       For french ALCASARistes
MIRRORLIST="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
############################
urpmi.removemedia -a
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main /media/main/release
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main_updates /media/main/updates
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib /media/contrib/release
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib_updates /media/contrib/updates
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
if [ "$nb_repository" != "4" ]
then
        echo
        echo "Une erreur a été détectée lors de la synchronisation des dépots."
        echo "Relancez l'installation ultérieurement."
        echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
        echo "An error occurs when synchronising repositories"
        echo "Try an other install later."
        echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
        exit 1
fi
# update testing and download RPM in cache 
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
echo "Updated RPM download. Please wait ..."
echo "Il est temps d'aller prendre un café :-) "
echo "You should now take a Beer ;-) "
urpmi --auto --auto-update --quiet --test --retry 2
if [ "$?" != "0" ]
then
        echo
        echo "Une erreur a été détectée lors de la récupération des paquetages."
        echo "Relancez l'installation ultérieurement."
        echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
        echo "An error occurs when downloading"
        echo "Try an other install later."
        echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
        exit 1
fi
# update with cached RPM
urpmi --auto --auto-update
# cleaning
urpme --auto --auto-orphans
exit 0