Subversion Repositories ALCASAR

Rev

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

#!/bin/sh
# $Id: alcasar-urpmi.sh 457 2011-01-16 22:40:10Z richard $
# script de mise à jour de la distribution 
# 3abtux
# changelog :
#       + Fait une mise à niveau du système actuel
#       + vérifie que la version actuelle du système est compatible avec un upgrade
#       + remplace les médias puis fait un upgrade

# Mise à niveau du système dans la version 2010.1

VERSION="2010.1"

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`
                echo $CURRENT_VERSION
                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)."
                exit 1          
                fi
        fi
        if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
        then 
                ARCH=`echo $i|cut -d"=" -f2`
        else
                ARCH="i586"
        fi
done
IFS="$old"
echo "Mise à niveau de la version actuelle"
urpmi --auto --auto-update
# migration si nécessaire
if [ $CURRENT_VERSION  == $VERSION ] || [ $CURRENT_VERSION == "2010.2" ]
then
        ############################
        # 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
                exit 1
        fi
        # Effectue la migration du système en mandriva $VERSION
        echo "Migration du système en Mandriva $VERSION ! Cela peut durer un certains temps ... "
        echo "Il est temps d'aller prendre un café :-) "
        urpmi --auto --auto-update
fi
# puis un peu de nettoyage
urpme --auto --auto-orphans
exit 0