1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
2 |
# $Id: alcasar-urpmi.sh 461 2011-01-18 21:10:27Z richard $
|
2 |
# $Id: alcasar-urpmi.sh 466 2011-01-19 21:08:38Z richard $
|
3 |
# script de mise à jour de la distribution
|
3 |
# script de mise à jour de la distribution
|
4 |
# 3abtux & rexy
|
4 |
# 3abtux & rexy
|
5 |
# changelog :
|
5 |
# changelog :
|
6 |
# + Fait une mise à niveau du système actuel
|
6 |
# + Fait une mise à niveau du système actuel
|
7 |
# + vérifie que la version actuelle du système est compatible
|
7 |
# + vérifie que la version actuelle du système est compatible
|
8 |
# + remplace les médias puis met à jour
|
8 |
# + remplace les médias puis met à jour
|
9 |
|
9 |
|
10 |
VERSION="2010.1"
|
10 |
VERSION="2010.1"
|
- |
|
11 |
ARCH="i586"
|
11 |
# extract the current Mandriva version and hardware architecture (i586 ou X64)
|
12 |
# extract the current Mandriva version and hardware architecture (i586 ou X64)
|
12 |
fic=`cat /etc/product.id`
|
13 |
fic=`cat /etc/product.id`
|
13 |
old="$IFS"
|
14 |
old="$IFS"
|
14 |
IFS=","
|
15 |
IFS=","
|
15 |
set $fic
|
16 |
set $fic
|
16 |
for i in $*
|
17 |
for i in $*
|
17 |
do
|
18 |
do
|
18 |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
|
19 |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
|
19 |
then
|
20 |
then
|
20 |
CURRENT_VERSION=`echo $i|cut -d"=" -f2`
|
21 |
CURRENT_VERSION=`echo $i|cut -d"=" -f2`
|
21 |
if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ]
|
22 |
if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ]
|
22 |
then
|
23 |
then
|
23 |
echo "La migration automatique du système ne peut être réalisée."
|
24 |
echo "La migration automatique du système ne peut être réalisée."
|
24 |
echo "Réalisez une mise à jour manuelle (cf. doc)."
|
25 |
echo "Réalisez une mise à jour manuelle (cf. doc)."
|
25 |
echo "The automatic system update can't perform."
|
26 |
echo "The automatic system update can't perform."
|
26 |
echo "Do a manual update (see doc)."
|
27 |
echo "Do a manual update (see doc)."
|
27 |
exit 1
|
28 |
exit 1
|
28 |
fi
|
29 |
fi
|
29 |
fi
|
30 |
fi
|
30 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
31 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
31 |
then
|
32 |
then
|
32 |
ARCH=`echo $i|cut -d"=" -f2`
|
33 |
ARCH=`echo $i|cut -d"=" -f2`
|
33 |
else
|
- |
|
34 |
ARCH="i586"
|
- |
|
35 |
fi
|
34 |
fi
|
36 |
done
|
35 |
done
|
37 |
IFS="$old"
|
36 |
IFS="$old"
|
38 |
###########################
|
37 |
###########################
|
39 |
# For International install
|
38 |
# For International install
|
40 |
#MIRRORLIST="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
|
39 |
#MIRRORLIST="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
|
41 |
# For french ALCASARistes
|
40 |
# For french ALCASARistes
|
42 |
MIRRORLIST="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
|
41 |
MIRRORLIST="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
|
43 |
############################
|
42 |
############################
|
44 |
urpmi.removemedia -a
|
43 |
urpmi.removemedia -a
|
45 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main /media/main/release
|
44 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main /media/main/release
|
46 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main_updates /media/main/updates
|
45 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST main_updates /media/main/updates
|
47 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib /media/contrib/release
|
46 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib /media/contrib/release
|
48 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib_updates /media/contrib/updates
|
47 |
urpmi.addmedia --probe-synthesis --mirrorlist $MIRRORLIST contrib_updates /media/contrib/updates
|
49 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
48 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
50 |
if [ "$nb_repository" != "4" ]
|
49 |
if [ "$nb_repository" != "4" ]
|
51 |
then
|
50 |
then
|
52 |
exit 1
|
51 |
exit 1
|
53 |
fi
|
52 |
fi
|
54 |
# update testing and download RPM in cache
|
53 |
# update testing and download RPM in cache
|
55 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
54 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
56 |
echo "Updated RPM download. Please wait ..."
|
55 |
echo "Updated RPM download. Please wait ..."
|
57 |
echo "Il est temps d'aller prendre un café :-) "
|
56 |
echo "Il est temps d'aller prendre un café :-) "
|
58 |
echo "You should now take a Beer ;-) "
|
57 |
echo "You should now take a Beer ;-) "
|
59 |
urpmi --auto --auto-update --quiet --test --retry 2
|
58 |
urpmi --auto --auto-update --quiet --test --retry 2
|
60 |
if [ "$?" != "0" ]
|
59 |
if [ "$?" != "0" ]
|
61 |
then
|
60 |
then
|
62 |
echo
|
61 |
echo
|
63 |
echo "Une erreur a été détectée lors de la récupération des paquetages de mise à jour."
|
62 |
echo "Une erreur a été détectée lors de la récupération des paquetages de mise à jour."
|
64 |
echo "Relancez l'installation ultérieurement."
|
63 |
echo "Relancez l'installation ultérieurement."
|
65 |
echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
|
64 |
echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
|
66 |
echo "An error occurs when downloading"
|
65 |
echo "An error occurs when downloading"
|
67 |
echo "Try an other install later."
|
66 |
echo "Try an other install later."
|
68 |
echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
|
67 |
echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
|
69 |
fi
|
68 |
fi
|
70 |
# update with cached RPM
|
69 |
# update with cached RPM
|
71 |
urpmi --auto --auto-update
|
70 |
urpmi --auto --auto-update
|
72 |
# cleaning
|
71 |
# cleaning
|
73 |
urpme --auto --auto-orphans
|
72 |
urpme --auto --auto-orphans
|
74 |
exit 0
|
73 |
exit 0
|
75 |
|
74 |
|
76 |
|
75 |
|