Subversion Repositories ALCASAR

Rev

Rev 456 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
230 franck 1
#!/bin/sh
2
# $Id: alcasar-urpmi.sh 457 2011-01-16 22:40:10Z richard $
3
# script de mise à jour de la distribution 
4
# 3abtux
5
# changelog :
456 franck 6
# 	+ Fait une mise à niveau du système actuel
230 franck 7
#	+ vérifie que la version actuelle du système est compatible avec un upgrade
8
#	+ remplace les médias puis fait un upgrade
9
 
456 franck 10
# Mise à niveau du système dans la version 2010.1
230 franck 11
 
456 franck 12
VERSION="2010.1"
386 franck 13
 
230 franck 14
fic=`cat /etc/product.id`
457 richard 15
old="$IFS"
16
IFS=","
230 franck 17
set $fic
18
for i in $*
19
do
20
	if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
21
	then 
457 richard 22
		CURRENT_VERSION=`echo $i|cut -d"=" -f2`
23
		echo $CURRENT_VERSION
24
		if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ] 
230 franck 25
		then
457 richard 26
		      echo "La migration automatique du système ne peut être réalisée."
27
		      echo "Réalisez une mise à jour manuelle (cf. doc)."
456 franck 28
		exit 1		
230 franck 29
		fi
30
	fi
456 franck 31
	if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
32
	then 
33
		ARCH=`echo $i|cut -d"=" -f2`
34
	else
35
		ARCH="i586"
36
	fi
230 franck 37
done
457 richard 38
IFS="$old"
39
echo "Mise à niveau de la version actuelle"
456 franck 40
urpmi --auto --auto-update
457 richard 41
# migration si nécessaire
42
if [ $CURRENT_VERSION  == $VERSION ] || [ $CURRENT_VERSION == "2010.2" ]
43
then
44
	############################
45
	# For International install
46
	# MIRRORLIST="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
47
 
48
	# For french ALCASARistes
49
	MIRRORLIST="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
50
	############################
456 franck 51
 
457 richard 52
	urpmi.removemedia -a
53
	urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main /media/main/release
54
	urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main_updates /media/main/updates
55
	urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib /media/contrib/release
56
	urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib_updates /media/contrib/updates
57
	nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
58
	if [ "$nb_repository" != "4" ]
59
	then
60
		exit 1
61
	fi
62
	# Effectue la migration du système en mandriva $VERSION
63
	echo "Migration du système en Mandriva $VERSION ! Cela peut durer un certains temps ... "
64
	echo "Il est temps d'aller prendre un café :-) "
65
	urpmi --auto --auto-update
230 franck 66
fi
386 franck 67
# puis un peu de nettoyage
456 franck 68
urpme --auto --auto-orphans
230 franck 69
exit 0
70
 
71
 
72