Subversion Repositories ALCASAR

Rev

Rev 525 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

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