Subversion Repositories ALCASAR

Rev

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

Rev 1785 Rev 1799
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-urpmi.sh 1785 2016-01-22 19:56:39Z richard $
2
# $Id: alcasar-urpmi.sh 1799 2016-02-28 12:15:23Z 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 9... Line 9...
9
# configure the RPM repository
9
# configure the RPM repository
10
 
10
 
11
Lang=`echo $LANG|cut -c 1-2`
11
Lang=`echo $LANG|cut -c 1-2`
12
VERSION="5"
12
VERSION="5"
13
ARCH="i586" 
13
ARCH="i586" 
-
 
14
# The kernel version we compile netflow for
-
 
15
KERNEL="kernel-server-4.1.15-2.mga5-1-1.mga5"
-
 
16
ModuleTree="kernel-server-4.1.15-2.mga5"
14
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
17
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
15
PACKAGES="vim-enhanced 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-mysqli php-mbstring php-sockets php-cli php-curl php-pdo_sqlite php-json rng-utils rsync clamav perl-rrdtool perl-MailTools perl-Socket6 fail2ban gnupg ulogd dkms-ipt_NETFLOW iptables-NETFLOW pm-fallback-policy ipset cronie-anacron gammu usbutils locales-en usb_modeswitch tinyproxy vnstat php-gd sudo iftop"
18
PACKAGES="vim-enhanced 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-mysqli php-mbstring php-sockets php-cli php-curl php-pdo_sqlite php-json rng-utils rsync clamav perl-rrdtool perl-MailTools perl-Socket6 fail2ban gnupg ulogd pm-fallback-policy ipset cronie-anacron gammu usbutils locales-en usb_modeswitch tinyproxy vnstat php-gd sudo iftop"
16
 
19
 
17
rpm_repository_sync ()
20
rpm_repository_sync ()
18
{
21
{
19
cat <<EOF > /etc/urpmi/urpmi.cfg
22
cat <<EOF > /etc/urpmi/urpmi.cfg
20
{
23
{
Line 36... Line 39...
36
else
39
else
37
	echo "Try an other install later."
40
	echo "Try an other install later."
38
	echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
41
	echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
39
fi
42
fi
40
}
43
}
-
 
44
 
41
# extract the current Mageia version and hardware architecture (i586 ou X64)
45
# extract the current Mageia version and hardware architecture (i586 ou X64)
42
fic=`cat /etc/product.id`
46
fic=`cat /etc/product.id`
43
old="$IFS"
47
old="$IFS"
44
IFS=","
48
IFS=","
45
set $fic
49
set $fic
Line 57... Line 61...
57
	then 
61
	then 
58
		ARCH=`echo $i|cut -d"=" -f2`
62
		ARCH=`echo $i|cut -d"=" -f2`
59
	fi
63
	fi
60
done
64
done
61
IFS="$old"
65
IFS="$old"
-
 
66
 
62
# We prefer wget than curl
67
# We prefer wget than curl
63
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
68
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
-
 
69
 
64
# Set the RPM repository (if not already set)
70
# Set the RPM repository (if not already set)
65
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l`
71
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l`
66
if [ "$ACTIVE_REPO" != "2" ]
72
if [ "$ACTIVE_REPO" != "2" ]
67
	then
73
	then
68
	MIRROR_NBR=2
74
	MIRROR_NBR=2
Line 107... Line 113...
107
			exit 1
113
			exit 1
108
			fi
114
			fi
109
		fi
115
		fi
110
	done
116
	done
111
fi
117
fi
-
 
118
 
-
 
119
# download the kernel used by ALCASAR and fix its version
-
 
120
if [ $Lang == "fr" ]
-
 
121
then	
-
 
122
	echo "Récupération du noyau Linux exploité par ALCASAR. Veuillez patienter ..."
-
 
123
else
-
 
124
	echo "Download the Linux kernel used by ALCASAR. Please wait ..."
-
 
125
fi
-
 
126
urpmi --auto --quiet $KERNEL
-
 
127
echo "/^kernel/" > /etc/urpmi/skip.list
-
 
128
 
112
# download updated RPM in cache 
129
# download updated RPM in cache 
113
if [ $Lang == "fr" ]
130
if [ $Lang == "fr" ]
114
then	
131
then	
115
	echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
132
	echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
116
	echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
133
	echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
Line 129... Line 146...
129
		echo "An error occurs when downloading RPMS"
146
		echo "An error occurs when downloading RPMS"
130
	fi
147
	fi
131
	rpm_error
148
	rpm_error
132
	exit 1
149
	exit 1
133
fi
150
fi
-
 
151
 
134
# update with cached RPM
152
# update with cached RPM
135
urpmi --auto --auto-update
153
urpmi --auto --auto-update
136
if [ "$?" != "0" ]
154
if [ "$?" != "0" ]
137
then
155
then
138
	echo
156
	echo
Line 145... Line 163...
145
	rpm_error
163
	rpm_error
146
	exit 1
164
	exit 1
147
fi
165
fi
148
# Clean the RPM cache
166
# Clean the RPM cache
149
urpmi --clean
167
urpmi --clean
-
 
168
 
150
# Download of ALCASAR specifics RPM in cache (and test)
169
# Download of ALCASAR specifics RPM in cache (and test)
151
if [ $Lang == "fr" ]
170
if [ $Lang == "fr" ]
152
then	
171
then	
153
	echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
172
	echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
154
else
173
else
Line 165... Line 184...
165
		echo "An error occurs when downloading complementary packages"
184
		echo "An error occurs when downloading complementary packages"
166
	fi
185
	fi
167
	rpm_error
186
	rpm_error
168
	exit 1
187
	exit 1
169
fi
188
fi
-
 
189
 
170
# update with cached RPM
190
# update with cached RPM
171
urpmi --auto $PACKAGES 
191
urpmi --auto $PACKAGES 
172
if [ "$?" != "0" ]
192
if [ "$?" != "0" ]
173
then
193
then
174
	echo
194
	echo
Line 179... Line 199...
179
		echo "An error occurs when installing complementary packages"
199
		echo "An error occurs when installing complementary packages"
180
	fi
200
	fi
181
	rpm_error
201
	rpm_error
182
	exit 1
202
	exit 1
183
fi
203
fi
-
 
204
 
-
 
205
# Keep only the kernel version we compil netflow with, and remove all others
-
 
206
kernelVersion=$(rpm -qa | grep "^kernel-")
-
 
207
for i in $kernelVersion
-
 
208
do
-
 
209
	if [ ! $i = $KERNEL ];then
-
 
210
		urpme --auto $i
-
 
211
	fi
-
 
212
done
-
 
213
 
184
# delete unused RPMs
214
# delete unused RPMs
185
if [ $Lang == "fr" ]
215
if [ $Lang == "fr" ]
186
then
216
then
187
	echo "Cleaning the system : "
217
	echo "Cleaning the system : "
188
else
218
else
189
	echo "Nettoyage du système : "
219
	echo "Nettoyage du système : "
190
fi
220
fi
191
for rm_rpm in shorewall mandi radeontool avahi mageia-gfxboot-theme privoxy cpupower squid gamin
221
for rm_rpm in shorewall mandi avahi mageia-gfxboot-theme privoxy cpupower squid gamin
192
do
222
do
193
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
223
	/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
194
	echo -n "."
224
	echo -n "."
195
done
225
done
196
 
226