| Line 1... |
Line 1... |
| 1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
| 2 |
# $Id: alcasar-urpmi.sh 1292 2014-01-11 11:51:08Z richard $
|
2 |
# $Id: alcasar-urpmi.sh 1336 2014-04-28 17:07:37Z 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 |
Lang=`echo $LANG|cut -c 1-2`
|
| 12 |
VERSION="2"
|
12 |
VERSION="4"
|
| 13 |
ARCH="i586"
|
13 |
ARCH="i586"
|
| 14 |
# The kernel version we compile netflow for
|
14 |
# The kernel version we compile netflow for
|
| 15 |
KERNEL="kernel-desktop-3.4.52-1.mga2-1-1.mga2"
|
15 |
#KERNEL="kernel-desktop-3.4.52-1.mga2-1-1.mga2"
|
| 16 |
ModuleTree="kernel-desktop-3.4.52-1.mga2"
|
16 |
#ModuleTree="kernel-desktop-3.4.52-1.mga2"
|
| 17 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
17 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
| 18 |
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 bind-utils openssh-server php-xml php-ldap php-mysql pam_ccreds rng-utils dnsmasq syslinux rsync cronie-anacron clamav pm-fallback-policy php-mbstring perl-rrdtool perl-MailTools perl-Socket6 php-sockets fail2ban gnupg man ipset"
|
18 |
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache apache-mod_ssl apache-mod_php iptables squid dansguardian postfix mariadb ntp bind-utils openssh-server php-xml php-ldap php-mysql php-mbstring php-sockets rng-utils dnsmasq rsync clamav pm-fallback-policy perl-rrdtool perl-MailTools perl-Socket6 fail2ban gnupg man ipset"
|
| 19 |
|
19 |
|
| 20 |
rpm_repository_sync ()
|
20 |
rpm_repository_sync ()
|
| 21 |
{
|
21 |
{
|
| 22 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
22 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
| 23 |
{
|
23 |
{
|
| Line 39... |
Line 39... |
| 39 |
else
|
39 |
else
|
| 40 |
echo "Try an other install later."
|
40 |
echo "Try an other install later."
|
| 41 |
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'"
|
| 42 |
fi
|
42 |
fi
|
| 43 |
}
|
43 |
}
|
| 44 |
# extract the current Mandriva/Mageia version and hardware architecture (i586 ou X64)
|
44 |
# extract the current Mageia version and hardware architecture (i586 ou X64)
|
| 45 |
fic=`cat /etc/product.id`
|
45 |
fic=`cat /etc/product.id`
|
| 46 |
unknown_os=0
|
46 |
unknown_os=0
|
| 47 |
old="$IFS"
|
47 |
old="$IFS"
|
| 48 |
IFS=","
|
48 |
IFS=","
|
| 49 |
set $fic
|
49 |
set $fic
|
| Line 64... |
Line 64... |
| 64 |
ARCH=`echo $i|cut -d"=" -f2`
|
64 |
ARCH=`echo $i|cut -d"=" -f2`
|
| 65 |
unknown_os=`expr $unknown_os + 1`
|
65 |
unknown_os=`expr $unknown_os + 1`
|
| 66 |
fi
|
66 |
fi
|
| 67 |
done
|
67 |
done
|
| 68 |
IFS="$old"
|
68 |
IFS="$old"
|
| 69 |
if [[ ( $unknown_os != 3 || "$DISTRIBUTION" != "Mageia" ) && ( "$CURRENT_VERSION" != "2" ) ]]
|
69 |
if [[ ( $unknown_os != 3 || "$DISTRIBUTION" != "Mageia" ) && ( "$CURRENT_VERSION" != "4" ) ]]
|
| 70 |
then
|
70 |
then
|
| 71 |
if [ $Lang == "fr" ]
|
71 |
if [ $Lang == "fr" ]
|
| 72 |
then
|
72 |
then
|
| 73 |
echo "La migration automatique d'ALCASAR ne peut pas être réalisée."
|
73 |
echo "La migration automatique d'ALCASAR ne peut pas être réalisée."
|
| 74 |
echo "Le système d'exploitation doit être remplacé"
|
74 |
echo "Le système d'exploitation doit être remplacé"
|
| Line 80... |
Line 80... |
| 80 |
then
|
80 |
then
|
| 81 |
echo
|
81 |
echo
|
| 82 |
if [ $Lang == "fr" ]
|
82 |
if [ $Lang == "fr" ]
|
| 83 |
then
|
83 |
then
|
| 84 |
echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)."
|
84 |
echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)."
|
| 85 |
echo "2 - Installez Linux-Mageia2 (cf. doc d'installation)"
|
85 |
echo "2 - Installez Linux-Mageia4 (cf. doc d'installation)"
|
| 86 |
echo "3 - copiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancer l'installation d'ALCASAR"
|
86 |
echo "3 - copiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancer l'installation d'ALCASAR"
|
| 87 |
else
|
87 |
else
|
| 88 |
echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)"
|
88 |
echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)"
|
| 89 |
echo "2 - Install Linux-Mageia2 (cf. installation doc)"
|
89 |
echo "2 - Install Linux-Mageia4 (cf. installation doc)"
|
| 90 |
echo "3 - Copy the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR"
|
90 |
echo "3 - Copy the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR"
|
| 91 |
fi
|
91 |
fi
|
| 92 |
fi
|
92 |
fi
|
| 93 |
exit 1
|
93 |
exit 1
|
| 94 |
fi
|
94 |
fi
|
| Line 136... |
Line 136... |
| 136 |
then
|
136 |
then
|
| 137 |
exit 1
|
137 |
exit 1
|
| 138 |
fi
|
138 |
fi
|
| 139 |
fi
|
139 |
fi
|
| 140 |
done
|
140 |
done
|
| - |
|
141 |
|
| 141 |
# delete unused RPMs
|
142 |
# delete unused RPMs
|
| 142 |
if [ $Lang == "fr" ]
|
143 |
if [ $Lang == "fr" ]
|
| 143 |
then
|
144 |
then
|
| 144 |
echo "Cleaning the system : "
|
145 |
echo "Cleaning the system : "
|
| 145 |
else
|
146 |
else
|
| 146 |
echo "Nettoyage du système : "
|
147 |
echo "Nettoyage du système : "
|
| 147 |
fi
|
148 |
fi
|
| 148 |
for rm_rpm in shorewall mandi radeontool avahi awstats
|
149 |
for rm_rpm in shorewall mandi radeontool mesa avahi
|
| 149 |
do
|
150 |
do
|
| 150 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
151 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
| 151 |
echo -n "."
|
152 |
echo -n "."
|
| 152 |
done
|
153 |
done
|
| 153 |
# download the kernel used by ALCASAR and fix its version
|
154 |
# download the kernel used by ALCASAR and fix its version
|
| 154 |
if [ $Lang == "fr" ]
|
155 |
#if [ $Lang == "fr" ]
|
| 155 |
then
|
156 |
#then
|
| 156 |
echo "Récupération du noyau Linux exploité par ALCASAR. Veuillez patienter ..."
|
157 |
# echo "Récupération du noyau Linux exploité par ALCASAR. Veuillez patienter ..."
|
| 157 |
else
|
158 |
#else
|
| 158 |
echo "Download the Linux kernel used by ALCASAR. Please wait ..."
|
159 |
# echo "Download the Linux kernel used by ALCASAR. Please wait ..."
|
| 159 |
fi
|
160 |
#fi
|
| 160 |
urpmi --auto --quiet $KERNEL
|
161 |
#urpmi --auto --quiet $KERNEL
|
| 161 |
echo "/^kernel/" > /etc/urpmi/skip.list
|
162 |
#echo "/^kernel/" > /etc/urpmi/skip.list
|
| 162 |
# download "timezone" to avoid a mageia issue --> should be remove with mageia3
|
163 |
# download "timezone" to avoid a mageia issue --> should be remove with mageia3
|
| 163 |
urpmi timezone
|
164 |
#urpmi timezone
|
| 164 |
# download updated RPM in cache
|
165 |
# download updated RPM in cache
|
| 165 |
if [ $Lang == "fr" ]
|
166 |
if [ $Lang == "fr" ]
|
| 166 |
then
|
167 |
then
|
| 167 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
168 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
| 168 |
echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
|
169 |
echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
|
| Line 231... |
Line 232... |
| 231 |
echo "An error occurs when installing complementary packages"
|
232 |
echo "An error occurs when installing complementary packages"
|
| 232 |
fi
|
233 |
fi
|
| 233 |
rpm_error
|
234 |
rpm_error
|
| 234 |
exit 1
|
235 |
exit 1
|
| 235 |
fi
|
236 |
fi
|
| 236 |
# Keep only the kernel version we compil netflow with, and remove all others
|
237 |
# Keep only the last kernel version
|
| 237 |
kernelVersion=$(rpm -qa | grep "kernel-desktop")
|
238 |
#kernelVersion=$(rpm -qa | grep "kernel-desktop")
|
| 238 |
for i in $kernelVersion
|
239 |
#for i in $kernelVersion
|
| 239 |
do
|
240 |
#do
|
| 240 |
if [ ! $i = $KERNEL ];then
|
241 |
# if [ ! $i = $KERNEL ];then
|
| 241 |
urpme --auto $i
|
242 |
# urpme --auto $i
|
| 242 |
fi
|
243 |
# fi
|
| 243 |
done
|
244 |
#done
|
| - |
|
245 |
echo "STOP"; read a
|
| 244 |
# delete old alcasar RPMs and unused services
|
246 |
# delete unused services
|
| 245 |
for rm_rpm in c-icap-server lib64chilli0 libchilli0 python-coova-chilli cyrus-sasl mageia-gfxboot-theme
|
247 |
for rm_rpm in c-icap-server mageia-gfxboot-theme
|
| 246 |
do
|
248 |
do
|
| 247 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
249 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
| 248 |
done
|
250 |
done
|
| 249 |
|
251 |
|
| 250 |
# Save chilli launch script (erase with new rpm one)
|
252 |
# Save chilli launch script (erase with new rpm one)
|