Subversion Repositories ALCASAR

Rev

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

Rev 1349 Rev 1350
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-urpmi.sh 1349 2014-05-14 14:52:19Z richard $
2
# $Id: alcasar-urpmi.sh 1350 2014-05-14 16:14:43Z 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
 
Line 10... Line 10...
10
 
10
 
11
Lang=`echo $LANG|cut -c 1-2`
11
Lang=`echo $LANG|cut -c 1-2`
12
VERSION="4"
12
VERSION="4"
13
ARCH="i586" 
13
ARCH="i586" 
14
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
14
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
15
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache apache-mod_ssl apache-mod_php dansguardian ipset postfix mariadb ntp bind-utils openssh-server php-mysqli php-xml php-ldap php-mysql php-mbstring php-sockets rng-utils dnsmasq rsync clamav perl-rrdtool perl-MailTools perl-Socket6 fail2ban gnupg ulogd man pm-fallback-policy gammu usbutils locales-en "
15
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache apache-mod_ssl apache-mod_php dansguardian postfix mariadb ntp bind-utils openssh-server php-xml php-ldap php-mysql php-mbstring php-sockets rng-utils dnsmasq rsync clamav perl-rrdtool perl-MailTools perl-Socket6 fail2ban gnupg ulogd man"
16
 
16
 
17
rpm_repository_sync ()
17
rpm_repository_sync ()
18
{
18
{
19
cat <<EOF > /etc/urpmi/urpmi.cfg
19
cat <<EOF > /etc/urpmi/urpmi.cfg
20
{
20
{
Line 89... Line 89...
89
	fi
89
	fi
90
	exit 1
90
	exit 1
91
fi
91
fi
92
# We prefer wget than curl
92
# We prefer wget than curl
93
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
93
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
94
# Set the RPM repository
94
# Set the RPM repository (if not already set)
95
MIRROR_NBR=2
-
 
96
#                       For Europeans 
-
 
97
MIRRORLIST1="http://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/$VERSION/$ARCH"
-
 
98
#                       For International install
-
 
99
MIRRORLIST2="http://mirrors.mageia.org/api/mageia.$VERSION.$ARCH.list"
-
 
100
try_nb="0"; nb_repository="0"
-
 
101
while [ "$nb_repository" != "2" ]
-
 
102
do
-
 
103
	try_nb=`expr $try_nb + 1`
-
 
104
	MIRRORLIST="MIRRORLIST$try_nb"
-
 
105
	rpm_repository_sync 
-
 
106
	nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
95
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep key-ids|wc -l`
107
	if [ "$nb_repository" != "2" ]
96
if [ "$ACTIVE_REPO" != "2" ]
108
	then
97
	then
109
		if [ $Lang == "fr" ]
98
	MIRROR_NBR=2
110
		then	
99
	#                       For Europeans 
111
			echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
100
	MIRRORLIST1="http://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/$VERSION/$ARCH"
112
		else
-
 
113
			echo "An error occurs when synchronising the repositories N°$try_nb"
101
	#                       For International install
114
		fi
-
 
115
		if [ $(expr $try_nb) -eq $MIRROR_NBR ]
102
	MIRRORLIST2="http://mirrors.mageia.org/api/mageia.$VERSION.$ARCH.list"
116
		then
-
 
117
			rpm_error
103
	try_nb="0"; nb_repository="0"
118
			exit 1
-
 
119
		fi
-
 
120
		if [ $Lang == "fr" ]
104
	while [ "$nb_repository" != "2" ]
121
		then	
-
 
122
			echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
-
 
123
		else
-
 
124
			echo "Do you wan't to try a synchronisation with an other repository?"
-
 
125
		fi
105
	do
126
		response=0
106
		try_nb=`expr $try_nb + 1`
127
		PTN='^[oOnNyY]$'
107
		MIRRORLIST="MIRRORLIST$try_nb"
128
		until [[ $(expr $response : $PTN) -gt 0 ]]
108
		rpm_repository_sync 
129
		do
-
 
130
			read response
109
		nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
131
		done
-
 
132
		if [ "$response" = "n" ] || [ "$response" = "N" ] 
110
		if [ "$nb_repository" != "2" ]
133
		then
111
		then
-
 
112
			if [ $Lang == "fr" ]
-
 
113
			then	
-
 
114
				echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
-
 
115
			else
-
 
116
				echo "An error occurs when synchronising the repositories N°$try_nb"
-
 
117
			fi
-
 
118
			if [ $(expr $try_nb) -eq $MIRROR_NBR ]
-
 
119
			then
-
 
120
				rpm_error
-
 
121
				exit 1
-
 
122
			fi
-
 
123
			if [ $Lang == "fr" ]
-
 
124
			then	
-
 
125
				echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
-
 
126
			else
-
 
127
				echo "Do you wan't to try a synchronisation with an other repository?"
-
 
128
			fi
-
 
129
			response=0
-
 
130
			PTN='^[oOnNyY]$'
-
 
131
			until [[ $(expr $response : $PTN) -gt 0 ]]
-
 
132
			do
-
 
133
				read response
-
 
134
			done
-
 
135
			if [ "$response" = "n" ] || [ "$response" = "N" ] 
-
 
136
			then
134
			exit 1
137
			exit 1
-
 
138
			fi
135
		fi
139
		fi
136
	fi
-
 
137
done
140
	done
138
 
141
fi
139
# download updated RPM in cache 
142
# download updated RPM in cache 
140
if [ $Lang == "fr" ]
143
if [ $Lang == "fr" ]
141
then	
144
then	
142
	echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
145
	echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
143
	echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
146
	echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"