Subversion Repositories ALCASAR

Rev

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

#!/bin/sh
# $Id: alcasar-urpmi.sh 456 2011-01-15 11:15:25Z franck $
# 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 
                VERSION=`echo $i|cut -d"=" -f2`
                if [ $VERSION != 2009.0 -o $VERSION != 2009.1 -o $VERSION != 2010.0 -o $VERSION != 2010.2 ]
                then
                      echo "Désolé, la migration automatique du système ne peut être réalisée depuis une version inférieure à la 2009.0"
                      echo "Réalisez une nouvelle installation en 2010.1 (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 avant migration ! "
urpmi --auto --auto-update

############################
# 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

# puis un peu de nettoyage
urpme --auto --auto-orphans

exit 0