Subversion Repositories ALCASAR

Rev

Rev 799 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 799 Rev 806
1
#!/bin/sh
1
#!/bin/sh
2
# $Id: alcasar-urpmi.sh 799 2012-02-01 21:16:37Z richard $
2
# $Id: alcasar-urpmi.sh 806 2012-02-05 22:19:41Z richard $
3
 
3
 
4
# alcasar-urpmi.sh
4
# alcasar-urpmi.sh
5
# by Franck BOUIJOUX and Richard REY
5
# by Franck BOUIJOUX and Richard REY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
8
# script de mise en place des dépots RPM 
8
# script de mise en place des dépots RPM 
9
# configure the RPM repository
9
# configure the RPM repository
10
 
10
 
11
VERSION="2010.2"
11
VERSION="2010.2"
12
ARCH="i586" 
12
ARCH="i586" 
13
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
13
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
14
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php squid dansguardian postfix MySQL logwatch ntp awstats mondo cdrecord buffer vim-enhanced bind-utils wget arpscan ulogd openssh-server php-xml php-ldap pam_ccreds rng-utils lsb-release dnsmasq sudo cronie-anacron pciutils clamav pm-fallback-policy "
14
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php squid dansguardian postfix MySQL logwatch ntp awstats cdrecord buffer vim-enhanced bind-utils wget arpscan ulogd openssh-server php-xml php-ldap pam_ccreds rng-utils lsb-release dnsmasq sudo syslinux cronie-anacron pciutils clamav pm-fallback-policy "
15
 
15
 
16
rpm_repository_sync ()
16
rpm_repository_sync ()
17
{
17
{
18
echo ${!MIRRORLIST}
18
echo ${!MIRRORLIST}
19
urpmi.removemedia -a
19
urpmi.removemedia -a
20
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} main /media/main/release
20
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} main /media/main/release
21
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} main_updates /media/main/updates
21
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} main_updates /media/main/updates
22
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
22
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
23
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
23
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
24
}
24
}
25
 
25
 
26
rpm_error ()
26
rpm_error ()
27
{
27
{
28
echo
28
echo
29
echo "Relancez l'installation ultérieurement."
29
echo "Relancez l'installation ultérieurement."
30
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
30
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
31
echo "Try an other install later."
31
echo "Try an other install later."
32
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
32
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
33
}
33
}
34
# extract the current Mandriva version and hardware architecture (i586 ou X64)
34
# extract the current Mandriva version and hardware architecture (i586 ou X64)
35
fic=`cat /etc/product.id`
35
fic=`cat /etc/product.id`
36
old="$IFS"
36
old="$IFS"
37
IFS=","
37
IFS=","
38
set $fic
38
set $fic
39
for i in $*
39
for i in $*
40
do
40
do
41
	if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
41
	if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
42
	then 
42
	then 
43
		CURRENT_VERSION=`echo $i|cut -d"=" -f2`
43
		CURRENT_VERSION=`echo $i|cut -d"=" -f2`
44
		if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ] 
44
		if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ] 
45
		then
45
		then
46
		      echo "La migration automatique du système ne peut être réalisée."
46
		      echo "La migration automatique du système ne peut être réalisée."
47
		      echo "Réalisez une mise à jour manuelle (cf. doc)."
47
		      echo "Réalisez une mise à jour manuelle (cf. doc)."
48
		      echo "The automatic system update can't perform."
48
		      echo "The automatic system update can't perform."
49
		      echo "Do a manual update (see doc)."
49
		      echo "Do a manual update (see doc)."
50
		exit 1		
50
		exit 1		
51
		fi
51
		fi
52
	fi
52
	fi
53
	if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
53
	if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
54
	then 
54
	then 
55
		ARCH=`echo $i|cut -d"=" -f2`
55
		ARCH=`echo $i|cut -d"=" -f2`
56
	fi
56
	fi
57
done
57
done
58
IFS="$old"
58
IFS="$old"
59
# We prefer wget than curl
59
# We prefer wget than curl
60
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
60
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
61
# Set the RPM repository
61
# Set the RPM repository
62
MIRROR_NBR=2
62
MIRROR_NBR=2
63
#                       For french ALCASARistes
63
#                       For french ALCASARistes
64
MIRRORLIST2="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
64
MIRRORLIST1="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
65
#                       For International install
65
#                       For International install
66
MIRRORLIST1="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
66
MIRRORLIST2="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
67
try_nb="0"; nb_repository="0"
67
try_nb="0"; nb_repository="0"
68
while [ "$nb_repository" != "4" ]
68
while [ "$nb_repository" != "4" ]
69
do
69
do
70
	try_nb=`expr $try_nb + 1`
70
	try_nb=`expr $try_nb + 1`
71
	MIRRORLIST="MIRRORLIST$try_nb"
71
	MIRRORLIST="MIRRORLIST$try_nb"
72
	rpm_repository_sync 
72
	rpm_repository_sync 
73
	nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
73
	nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
74
	if [ "$nb_repository" != "4" ]
74
	if [ "$nb_repository" != "4" ]
75
	then
75
	then
76
		echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
76
		echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
77
		echo "An error occurs when synchronising the repositories N°$try_nb"
77
		echo "An error occurs when synchronising the repositories N°$try_nb"
78
		if [ $(expr $try_nb) -eq $MIRROR_NBR ]
78
		if [ $(expr $try_nb) -eq $MIRROR_NBR ]
79
		then
79
		then
80
			rpm_error
80
			rpm_error
81
			exit 1
81
			exit 1
82
		fi
82
		fi
83
		echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
83
		echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
84
		echo "Do you wan't to try a synchronisation with an other repository?"
84
		echo "Do you wan't to try a synchronisation with an other repository?"
85
		response=0
85
		response=0
86
		PTN='^[oOnNyY]$'
86
		PTN='^[oOnNyY]$'
87
		until [[ $(expr $response : $PTN) -gt 0 ]]
87
		until [[ $(expr $response : $PTN) -gt 0 ]]
88
		do
88
		do
89
			read response
89
			read response
90
		done
90
		done
91
		if [ "$response" = "n" ] || [ "$response" = "N" ] 
91
		if [ "$response" = "n" ] || [ "$response" = "N" ] 
92
		then
92
		then
93
			exit 1
93
			exit 1
94
		fi
94
		fi
95
	fi
95
	fi
96
done
96
done
97
# delete unused RPMs
97
# delete unused RPMs
98
echo "Cleaning the system : "
98
echo "Cleaning the system : "
99
for rm_rpm in shorewall dhcp-server cyrus-sasl distcache-server avahi mandi radeontool
99
for rm_rpm in shorewall dhcp-server cyrus-sasl distcache-server avahi mandi radeontool mondo mindi
100
do
100
do
101
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
101
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
102
	echo -n "."
102
	echo -n "."
103
done
103
done
104
echo
104
echo
105
# download RPM in cache 
105
# download RPM in cache 
106
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
106
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
107
echo "Updated RPM download. Please wait ..."
107
echo "Updated RPM download. Please wait ..."
108
echo "Il est temps d'aller prendre un café :-) "
108
echo "Il est temps d'aller prendre un café :-) "
109
echo "You should now take a Beer ;-) "
109
echo "You should now take a Beer ;-) "
110
urpmi --downloader wget --auto --auto-update --quiet --test --retry 2
110
urpmi --downloader wget --auto --auto-update --quiet --test --retry 2
111
if [ "$?" != "0" ]
111
if [ "$?" != "0" ]
112
then
112
then
113
	echo
113
	echo
114
	echo "Une erreur a été détectée lors de la récupération des paquetages."
114
	echo "Une erreur a été détectée lors de la récupération des paquetages."
115
	echo "An error occurs when downloading RPMS"
115
	echo "An error occurs when downloading RPMS"
116
	rpm_error
116
	rpm_error
117
	exit 1
117
	exit 1
118
fi
118
fi
119
# update with cached RPM
119
# update with cached RPM
120
urpmi --auto --auto-update
120
urpmi --auto --auto-update
121
if [ "$?" != "0" ]
121
if [ "$?" != "0" ]
122
then
122
then
123
	echo
123
	echo
124
	echo "Une erreur a été détectée lors de la mise à jour des paquetages."
124
	echo "Une erreur a été détectée lors de la mise à jour des paquetages."
125
	echo "An error occurs when updating packages"
125
	echo "An error occurs when updating packages"
126
	rpm_error
126
	rpm_error
127
	exit 1
127
	exit 1
128
fi
128
fi
129
# Clean the RPM cache
129
# Clean the RPM cache
130
urpmi --clean
130
urpmi --clean
131
# Download of ALCASAR specifics RPM in cache (and test)
131
# Download of ALCASAR specifics RPM in cache (and test)
132
echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
132
echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
133
echo "Download of complementary packages. Please wait ..."
133
echo "Download of complementary packages. Please wait ..."
134
urpmi --downloader wget --auto $PACKAGES --quiet --test --retry 2
134
urpmi --downloader wget --auto $PACKAGES --quiet --test --retry 2
135
if [ "$?" != "0" ]
135
if [ "$?" != "0" ]
136
then
136
then
137
	echo
137
	echo
138
	echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires."
138
	echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires."
139
	echo "An error occurs when downloading complementary packages"
139
	echo "An error occurs when downloading complementary packages"
140
	rpm_error
140
	rpm_error
141
	exit 1
141
	exit 1
142
fi
142
fi
143
# update with cached RPM
143
# update with cached RPM
144
urpmi --auto $PACKAGES 
144
urpmi --auto $PACKAGES 
145
if [ "$?" != "0" ]
145
if [ "$?" != "0" ]
146
then
146
then
147
	echo
147
	echo
148
	echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires."
148
	echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires."
149
	echo "An error occurs when installing complementary packages"
149
	echo "An error occurs when installing complementary packages"
150
	rpm_error
150
	rpm_error
151
	exit 1
151
	exit 1
152
fi
152
fi
153
# delete old alcasar RPMs
153
# delete old alcasar RPMs
154
for rm_rpm in c-icap-server lib64chilli0 libchilli0 python-coova-chilli
154
for rm_rpm in c-icap-server lib64chilli0 libchilli0 python-coova-chilli
155
do
155
do
156
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
156
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
157
done
157
done
158
# On installe les RPMs spécifiques à la version
158
# On installe les RPMs spécifiques à la version
159
urpmi --no-verify --auto conf/rpms/$ARCH/*.rpm
159
urpmi --no-verify --auto conf/rpms/$ARCH/*.rpm
160
# On empêche les mises à jour de coova-chilli et freeradius par le biais des dépôts
160
# On empêche les mises à jour de coova-chilli et freeradius par le biais des dépôts
161
for rpmskip in coova-chilli freeradius 
161
for rpmskip in coova-chilli freeradius 
162
do
162
do
163
	echo -n "/^$rpmskip/" >> /etc/urpmi/skip.list
163
	echo -n "/^$rpmskip/" >> /etc/urpmi/skip.list
164
done
164
done
165
# Clean the RPM cache
165
# Clean the RPM cache
166
urpmi --clean
166
urpmi --clean
167
exit 0
167
exit 0
168
 
168
 
169
 
169