Subversion Repositories ALCASAR

Rev

Rev 1056 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1056 Rev 1060
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-urpmi.sh 1056 2013-03-26 21:46:36Z stephane $
2
# $Id: alcasar-urpmi.sh 1060 2013-03-31 18:10:30Z richard $
3
 
3
 
4
# alcasar-urpmi.sh
4
# alcasar-urpmi.sh
5
# by 3abtux and Rexy
5
# by 3abtux and Rexy
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
Lang=`echo $LANG|cut -c 1-2`
11
VERSION="2"
12
VERSION="2"
12
ARCH="i586" 
13
ARCH="i586" 
13
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
14
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
14
PACKAGES="sudo freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php iptables squid dansguardian postfix mariadb logwatch ntp awstats bind-utils openssh-server php-xml php-ldap php-mysql pam_ccreds rng-utils dnsmasq syslinux rsync cronie-anacron clamav pm-fallback-policy"
15
PACKAGES="sudo freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php iptables squid dansguardian postfix mariadb logwatch ntp awstats bind-utils openssh-server php-xml php-ldap php-mysql pam_ccreds rng-utils dnsmasq syslinux rsync cronie-anacron clamav pm-fallback-policy"
15
 
16
 
Line 26... Line 27...
26
}
27
}
27
 
28
 
28
rpm_error ()
29
rpm_error ()
29
{
30
{
30
echo
31
echo
-
 
32
if [ $Lang == "fr" ]
-
 
33
then	
31
echo "Relancez l'installation ultérieurement."
34
	echo "Relancez l'installation ultérieurement."
32
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
35
	echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
-
 
36
else
33
echo "Try an other install later."
37
	echo "Try an other install later."
34
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
38
	echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
-
 
39
fi
35
}
40
}
36
# extract the current Mandriva/Mageia version and hardware architecture (i586 ou X64)
41
# extract the current Mandriva/Mageia version and hardware architecture (i586 ou X64)
37
fic=`cat /etc/product.id`
42
fic=`cat /etc/product.id`
38
unknown_os=0
43
unknown_os=0
39
old="$IFS"
44
old="$IFS"
Line 57... Line 62...
57
		unknown_os=`expr $unknown_os + 1`
62
		unknown_os=`expr $unknown_os + 1`
58
	fi
63
	fi
59
done
64
done
60
IFS="$old"
65
IFS="$old"
61
if [[ ( $unknown_os != 3 || "$DISTRIBUTION" != "Mageia" ) && ( "$CURRENT_VERSION" != "2" ) ]]
66
if [[ ( $unknown_os != 3 || "$DISTRIBUTION" != "Mageia" ) && ( "$CURRENT_VERSION" != "2" ) ]]
-
 
67
then
-
 
68
	if [ $Lang == "fr" ]
62
	then
69
	then	
63
	echo "le système Linux installé n'est pas conforme. Installez Mageia2 (cf documentation d'installation)"
70
		echo "La migration automatique d'ALCASAR ne peut pas être réalisée."
-
 
71
		echo "Le système d'exploitation doit être remplacer"
-
 
72
	else
64
	echo "the installed Linux operating system isn't conform. Install Mageia2 (see installation documentation)"
73
		echo "The automatic update of ALCASAR can't be performed."
-
 
74
		echo "The OS must be replaced"
-
 
75
	fi
65
	if [ -e /tmp/alcasar-conf.tar.gz ]
76
	if [ -e /tmp/alcasar-conf.tar.gz ]
66
		then
77
	then
67
		echo
78
		echo
-
 
79
		if [ $Lang == "fr" ]
-
 
80
		then	
-
 
81
			echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)."
68
		echo "La migration automatique du système ne peut pas être réalisée."
82
			echo "2 - Installez Linux-Mageia2 (cf. doc d'installation)"
69
		echo "Récupérez le fichier /tmp/alcasar-conf.tar.gz et faites une mise à jour manuelle (cf. readme.txt)."
83
			echo "3 - copiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancez l'installation d'ALCASAR"
-
 
84
		else
-
 
85
			echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)"
70
		echo "The automatic system update can't perform."
86
			echo "2 - Install Linux-Mageia2 (cf. installation doc)"
71
		echo "Retrieve the file /tmp/alcasar-conf.tar.gz and do a manual update (see readme.txt)."
87
			echo "3 - Copy the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR"
-
 
88
		fi
72
	fi
89
	fi
73
	exit 1
90
	exit 1
74
fi
91
fi
75
# We prefer wget than curl
92
# We prefer wget than curl
76
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
93
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
Line 87... Line 104...
87
	MIRRORLIST="MIRRORLIST$try_nb"
104
	MIRRORLIST="MIRRORLIST$try_nb"
88
	rpm_repository_sync 
105
	rpm_repository_sync 
89
	nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
106
	nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
90
	if [ "$nb_repository" != "2" ]
107
	if [ "$nb_repository" != "2" ]
91
	then
108
	then
-
 
109
		if [ $Lang == "fr" ]
-
 
110
		then	
92
		echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
111
			echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
-
 
112
		else
93
		echo "An error occurs when synchronising the repositories N°$try_nb"
113
			echo "An error occurs when synchronising the repositories N°$try_nb"
-
 
114
		fi
94
		if [ $(expr $try_nb) -eq $MIRROR_NBR ]
115
		if [ $(expr $try_nb) -eq $MIRROR_NBR ]
95
		then
116
		then
96
			rpm_error
117
			rpm_error
97
			exit 1
118
			exit 1
98
		fi
119
		fi
-
 
120
		if [ $Lang == "fr" ]
-
 
121
		then	
99
		echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
122
			echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
-
 
123
		else
100
		echo "Do you wan't to try a synchronisation with an other repository?"
124
			echo "Do you wan't to try a synchronisation with an other repository?"
-
 
125
		fi
101
		response=0
126
		response=0
102
		PTN='^[oOnNyY]$'
127
		PTN='^[oOnNyY]$'
103
		until [[ $(expr $response : $PTN) -gt 0 ]]
128
		until [[ $(expr $response : $PTN) -gt 0 ]]
104
		do
129
		do
105
			read response
130
			read response
Line 117... Line 142...
117
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
142
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
118
	echo -n "."
143
	echo -n "."
119
done
144
done
120
echo
145
echo
121
# download RPM in cache 
146
# download RPM in cache 
-
 
147
if [ $Lang == "fr" ]
-
 
148
then	
122
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
149
	echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
123
echo "Updated RPM download. Please wait ..."
150
	echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
-
 
151
else
124
echo "Il est temps d'aller prendre un café :-) "
152
	echo "Updated RPM download. Please wait ..."
125
echo "You should now take a Beer ;-) "
153
	echo "You should now take a coffe (or a good beer) ;-)"
-
 
154
fi
126
urpmi --auto --auto-update --quiet --test --retry 2
155
urpmi --auto --auto-update --quiet --test --retry 2
127
if [ "$?" != "0" ]
156
if [ "$?" != "0" ]
128
then
157
then
129
	echo
158
	echo
-
 
159
	if [ $Lang == "fr" ]
-
 
160
	then	
130
	echo "Une erreur a été détectée lors de la récupération des paquetages."
161
		echo "Une erreur a été détectée lors de la récupération des paquetages."
-
 
162
	else
131
	echo "An error occurs when downloading RPMS"
163
		echo "An error occurs when downloading RPMS"
-
 
164
	fi
132
	rpm_error
165
	rpm_error
133
	exit 1
166
	exit 1
134
fi
167
fi
135
# update with cached RPM
168
# update with cached RPM
136
urpmi --auto --auto-update
169
urpmi --auto --auto-update
137
if [ "$?" != "0" ]
170
if [ "$?" != "0" ]
138
then
171
then
139
	echo
172
	echo
-
 
173
	if [ $Lang == "fr" ]
-
 
174
	then	
140
	echo "Une erreur a été détectée lors de la mise à jour des paquetages."
175
		echo "Une erreur a été détectée lors de la mise à jour des paquetages."
-
 
176
	else
141
	echo "An error occurs when updating packages"
177
		echo "An error occurs when updating packages"
-
 
178
	fi
142
	rpm_error
179
	rpm_error
143
	exit 1
180
	exit 1
144
fi
181
fi
145
# Clean the RPM cache
182
# Clean the RPM cache
146
urpmi --clean
183
urpmi --clean
147
# Download of ALCASAR specifics RPM in cache (and test)
184
# Download of ALCASAR specifics RPM in cache (and test)
-
 
185
if [ $Lang == "fr" ]
-
 
186
then	
148
echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
187
	echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
-
 
188
else
149
echo "Download of complementary packages. Please wait ..."
189
	echo "Download of complementary packages. Please wait ..."
-
 
190
fi
150
urpmi --auto $PACKAGES --quiet --test --retry 2
191
urpmi --auto $PACKAGES --quiet --test --retry 2
151
if [ "$?" != "0" ]
192
if [ "$?" != "0" ]
152
then
193
then
153
	echo
194
	echo
-
 
195
	if [ $Lang == "fr" ]
-
 
196
	then	
154
	echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires."
197
		echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires."
-
 
198
	else
155
	echo "An error occurs when downloading complementary packages"
199
		echo "An error occurs when downloading complementary packages"
-
 
200
	fi
156
	rpm_error
201
	rpm_error
157
	exit 1
202
	exit 1
158
fi
203
fi
159
# update with cached RPM
204
# update with cached RPM
160
urpmi --auto $PACKAGES 
205
urpmi --auto $PACKAGES 
161
if [ "$?" != "0" ]
206
if [ "$?" != "0" ]
162
then
207
then
163
	echo
208
	echo
-
 
209
	if [ $Lang == "fr" ]
-
 
210
	then	
164
	echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires."
211
		echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires."
-
 
212
	else
165
	echo "An error occurs when installing complementary packages"
213
		echo "An error occurs when installing complementary packages"
-
 
214
	fi
166
	rpm_error
215
	rpm_error
167
	exit 1
216
	exit 1
168
fi
217
fi
169
# delete old alcasar RPMs and unused services
218
# delete old alcasar RPMs and unused services
170
for rm_rpm in c-icap-server lib64chilli0 libchilli0 python-coova-chilli cyrus-sasl mageia-gfxboot-theme
219
for rm_rpm in c-icap-server lib64chilli0 libchilli0 python-coova-chilli cyrus-sasl mageia-gfxboot-theme
Line 178... Line 227...
178
# restore chilli launch script
227
# restore chilli launch script
179
[ -e /tmp/chilli.conf ] && mv /tmp/chilli.conf /etc/
228
[ -e /tmp/chilli.conf ] && mv /tmp/chilli.conf /etc/
180
# Clean the RPM cache
229
# Clean the RPM cache
181
urpmi --clean
230
urpmi --clean
182
exit 0
231
exit 0
183
 
-