| Line 1... |
Line 1... |
| 1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
| 2 |
# $Id: alcasar-urpmi.sh 489 2011-02-13 17:32:07Z richard $
|
2 |
# $Id: alcasar-urpmi.sh 497 2011-02-17 21:36:20Z richard $
|
| 3 |
# script de mise à jour de la distribution
|
3 |
# script de mise en place des dépots RPM
|
| 4 |
# 3abtux & rexy
|
4 |
# 3abtux & rexy
|
| 5 |
# changelog :
|
5 |
|
| 6 |
# + Fait une mise à niveau du système actuel
|
- |
|
| 7 |
# + vérifie que la version actuelle du système est compatible
|
- |
|
| 8 |
# + remplace les médias puis met à jour
|
- |
|
| 9 |
|
6 |
|
| 10 |
VERSION="2010.2"
|
7 |
VERSION="2010.2"
|
| 11 |
ARCH="i586"
|
8 |
ARCH="i586"
|
| - |
|
9 |
# For french ALCASARistes
|
| - |
|
10 |
MIRRORLIST1="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
|
| - |
|
11 |
# For International install
|
| - |
|
12 |
MIRRORLIST2="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
|
| - |
|
13 |
MIRROR_NBR=2
|
| - |
|
14 |
|
| - |
|
15 |
rpm_repository_sync ()
|
| - |
|
16 |
{
|
| - |
|
17 |
echo ${!MIRRORLIST}
|
| - |
|
18 |
urpmi.removemedia -a
|
| - |
|
19 |
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} main /media/main/release
|
| - |
|
20 |
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} main_updates /media/main/updates
|
| - |
|
21 |
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
|
| - |
|
22 |
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
|
| - |
|
23 |
}
|
| - |
|
24 |
|
| 12 |
# extract the current Mandriva version and hardware architecture (i586 ou X64)
|
25 |
# extract the current Mandriva version and hardware architecture (i586 ou X64)
|
| 13 |
fic=`cat /etc/product.id`
|
26 |
fic=`cat /etc/product.id`
|
| 14 |
old="$IFS"
|
27 |
old="$IFS"
|
| 15 |
IFS=","
|
28 |
IFS=","
|
| 16 |
set $fic
|
29 |
set $fic
|
| Line 32... |
Line 45... |
| 32 |
then
|
45 |
then
|
| 33 |
ARCH=`echo $i|cut -d"=" -f2`
|
46 |
ARCH=`echo $i|cut -d"=" -f2`
|
| 34 |
fi
|
47 |
fi
|
| 35 |
done
|
48 |
done
|
| 36 |
IFS="$old"
|
49 |
IFS="$old"
|
| 37 |
###########################
|
50 |
# Set the RPM repository
|
| 38 |
# For International install
|
51 |
try_nb="0"; nb_repository="0"
|
| 39 |
#MIRRORLIST="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
|
52 |
while [ "$nb_repository" != "4" ]
|
| - |
|
53 |
do
|
| 40 |
# For french ALCASARistes
|
54 |
try_nb=`expr $try_nb + 1`
|
| 41 |
MIRRORLIST="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
|
- |
|
| 42 |
############################
|
55 |
MIRRORLIST="MIRRORLIST$try_nb"
|
| 43 |
urpmi.removemedia -a
|
56 |
rpm_repository_sync
|
| 44 |
urpmi.addmedia --wget --probe-synthesis --mirrorlist $MIRRORLIST main /media/main/release
|
- |
|
| 45 |
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist $MIRRORLIST main_updates /media/main/updates
|
- |
|
| 46 |
urpmi.addmedia --wget --probe-synthesis --mirrorlist $MIRRORLIST contrib /media/contrib/release
|
- |
|
| 47 |
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist $MIRRORLIST contrib_updates /media/contrib/updates
|
- |
|
| 48 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
57 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
| 49 |
if [ "$nb_repository" != "4" ]
|
58 |
if [ "$nb_repository" != "4" ]
|
| 50 |
then
|
59 |
then
|
| 51 |
echo
|
- |
|
| 52 |
echo "Une erreur a été détectée lors de la synchronisation des dépots."
|
60 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
| - |
|
61 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
| - |
|
62 |
if [ $(expr $try_nb) -eq $MIRROR_NBR ]
|
| - |
|
63 |
then
|
| - |
|
64 |
echo
|
| 53 |
echo "Relancez l'installation ultérieurement."
|
65 |
echo "Relancez l'installation ultérieurement."
|
| 54 |
echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
|
66 |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
|
| 55 |
echo "An error occurs when synchronising repositories"
|
- |
|
| 56 |
echo "Try an other install later."
|
67 |
echo "Try an other install later."
|
| 57 |
echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
|
68 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
|
| - |
|
69 |
exit 1
|
| - |
|
70 |
fi
|
| - |
|
71 |
echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
|
| - |
|
72 |
echo "Do you wan't to try a synchronisation with an other repository?"
|
| - |
|
73 |
response=0
|
| - |
|
74 |
PTN='^[oOnNyY]$'
|
| - |
|
75 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
| - |
|
76 |
do
|
| - |
|
77 |
read response
|
| - |
|
78 |
done
|
| - |
|
79 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
| - |
|
80 |
then
|
| 58 |
exit 1
|
81 |
exit 1
|
| - |
|
82 |
fi
|
| 59 |
fi
|
83 |
fi
|
| - |
|
84 |
done
|
| 60 |
# update testing and download RPM in cache
|
85 |
# download RPM in cache
|
| 61 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
86 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
| 62 |
echo "Updated RPM download. Please wait ..."
|
87 |
echo "Updated RPM download. Please wait ..."
|
| 63 |
echo "Il est temps d'aller prendre un café :-) "
|
88 |
echo "Il est temps d'aller prendre un café :-) "
|
| 64 |
echo "You should now take a Beer ;-) "
|
89 |
echo "You should now take a Beer ;-) "
|
| 65 |
urpmi --auto --auto-update --quiet --test --retry 2
|
90 |
urpmi --auto --auto-update --quiet --test --retry 2
|
| 66 |
if [ "$?" != "0" ]
|
91 |
if [ "$?" != "0" ]
|
| 67 |
then
|
92 |
then
|
| 68 |
echo
|
93 |
echo
|
| 69 |
echo "Une erreur a été détectée lors de la récupération des paquetages."
|
94 |
echo "Une erreur a été détectée lors de la récupération des paquetages."
|
| 70 |
echo "Relancez l'installation ultérieurement."
|
95 |
echo "Relancez l'installation ultérieurement."
|
| 71 |
echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
|
96 |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
|
| 72 |
echo "An error occurs when downloading"
|
97 |
echo "An error occurs when downloading"
|
| 73 |
echo "Try an other install later."
|
98 |
echo "Try an other install later."
|
| 74 |
echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
|
99 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
|
| 75 |
exit 1
|
100 |
exit 1
|
| 76 |
fi
|
101 |
fi
|
| 77 |
# update with cached RPM
|
102 |
# update with cached RPM
|
| 78 |
urpmi --auto --auto-update
|
103 |
urpmi --auto --auto-update
|
| 79 |
# cleaning
|
104 |
# cleaning
|