1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
|
2 |
|
3 |
# alcasar-rpm.sh
|
3 |
# alcasar-rpm.sh
|
4 |
# by 3abtux and Rexy
|
4 |
# by 3abtux and Rexy
|
5 |
# This script is distributed under the Gnu General Public License (GPL)
|
5 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
|
6 |
|
7 |
# script de mise en place des dépots RPM + installation des RPM complémentaires
|
7 |
# script de mise en place des dépots RPM + installation des RPM complémentaires
|
8 |
# configure the RPM repository + complementary RPM installation
|
8 |
# configure the RPM repository + complementary RPM installation
|
9 |
|
9 |
|
10 |
Lang=`echo $LANG|cut -c 1-2`
|
10 |
Lang=`echo $LANG|cut -c 1-2`
|
11 |
SED="/bin/sed -i"
|
11 |
SED="/bin/sed -i"
|
12 |
VERSION="9"
|
12 |
VERSION="9"
|
13 |
ARCH="x86_64"
|
13 |
ARCH="x86_64"
|
14 |
# The kernel version we compile netflow for
|
14 |
# The kernel version we compile netflow for
|
15 |
KERNEL="kernel-server-6.6.28-1.mga9"
|
15 |
KERNEL="kernel-server-6.6.28-1.mga9"
|
16 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
16 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
17 |
# (old) perl-Socket6 : needed by nfsen
|
17 |
# (old) perl-Socket6 : needed by nfsen
|
18 |
# "fonts-dejavu-common" & "fonts-ttf-dejavu" : fonts needed by wkhtmltopdf
|
18 |
# "fonts-dejavu-common" & "fonts-ttf-dejavu" : fonts needed by wkhtmltopdf
|
19 |
# "lsscsi" & nvme-cli" & "php-dom" : needed by phpsysinfo
|
19 |
# "lsscsi" & nvme-cli" & "php-dom" : needed by phpsysinfo
|
20 |
# "socat" : avoid a warning when run the install script of letsencrypt ("acme.sh")
|
20 |
# "socat" : avoid a warning when run the install script of letsencrypt ("acme.sh")
|
21 |
# "sudo" : needed after a reinstallation (to be investigated)
|
21 |
# "sudo" : needed after a reinstallation (to be investigated)
|
22 |
# "postfix" + "cyrus-sasl" + "lib64sasl2-plug-plain" : email registration method
|
22 |
# "postfix" + "cyrus-sasl" + "lib64sasl2-plug-plain" : email registration method
|
23 |
# "nmap" : "/usr/share/nmap/nmap-mac-prefixes" is used to display MAC manufacturers in ACC
|
23 |
# "nmap" : "/usr/share/nmap/nmap-mac-prefixes" is used to display MAC manufacturers in ACC
|
24 |
|
24 |
|
25 |
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite php-cli php-dom php-filter unbound e2guardian postfix mariadb ntpsec bind-utils openssh-server rng-utils rsync fail2ban gnupg2 ulogd ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware kernel-firmware-nonfree dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat postfix cyrus-sasl lib64sasl2-plug-plain iftop"
|
25 |
PACKAGES="vim-enhanced freeradius freeradius-mysql freeradius-ldap lighttpd lighttpd-mod_auth php-fpm php-gd php-ldap php-mysqli php-mbstring php-sockets php-curl php-pdo_sqlite php-cli php-dom php-filter unbound e2guardian postfix mariadb ntpsec bind-utils openssh-server rng-utils rsync fail2ban gnupg2 ulogd ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware kernel-firmware-nonfree dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat postfix cyrus-sasl lib64sasl2-plug-plain iftop"
|
26 |
|
26 |
|
27 |
rpm_repository_sync ()
|
27 |
rpm_repository_sync ()
|
28 |
{
|
28 |
{
|
29 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
29 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
30 |
{
|
30 |
{
|
31 |
downloader: wget
|
31 |
downloader: wget
|
32 |
}
|
32 |
}
|
33 |
EOF
|
33 |
EOF
|
34 |
echo ${!MIRRORLIST}
|
34 |
echo ${!MIRRORLIST}
|
35 |
urpmi.addmedia core --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/release
|
35 |
urpmi.addmedia core --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/release
|
36 |
urpmi.addmedia core-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/updates
|
36 |
urpmi.addmedia core-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/updates
|
37 |
urpmi.addmedia nonfree --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/release
|
37 |
urpmi.addmedia nonfree --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/release
|
38 |
urpmi.addmedia nonfree-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/updates
|
38 |
urpmi.addmedia nonfree-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/updates
|
39 |
}
|
39 |
}
|
40 |
|
40 |
|
41 |
rpm_error ()
|
41 |
rpm_error ()
|
42 |
{
|
42 |
{
|
43 |
# restore previous rpm conf file & removed RPMs
|
43 |
# restore previous rpm conf file & removed RPMs
|
44 |
[ -e /etc/urpmi/urpmi.cfg.old ] && mv /etc/urpmi/urpmi.cfg.old /etc/urpmi/urpmi.cfg
|
44 |
[ -e /etc/urpmi/urpmi.cfg.old ] && mv /etc/urpmi/urpmi.cfg.old /etc/urpmi/urpmi.cfg
|
45 |
urpmi --no-verify-rpm --auto rpms/$ARCH/wkhtmltopdf*.rpm
|
45 |
urpmi --no-verify-rpm --auto rpms/$ARCH/wkhtmltopdf*.rpm
|
46 |
echo
|
46 |
echo
|
47 |
if [ $Lang == "fr" ]
|
47 |
if [ $Lang == "fr" ]
|
48 |
then
|
48 |
then
|
49 |
echo "Relancez l'installation ultérieurement."
|
49 |
echo "Relancez l'installation ultérieurement."
|
50 |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-rpm.sh'"
|
50 |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-rpm.sh'"
|
51 |
else
|
51 |
else
|
52 |
echo "Try an other install later."
|
52 |
echo "Try an other install later."
|
53 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-rpm.sh'"
|
53 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-rpm.sh'"
|
54 |
fi
|
54 |
fi
|
55 |
}
|
55 |
}
|
56 |
|
56 |
|
57 |
# We prefer wget than curl
|
57 |
# We prefer wget than curl
|
58 |
wget_exist=`rpm -qa|grep wget|wc -l`
|
58 |
wget_exist=`rpm -qa|grep wget|wc -l`
|
59 |
if [ "$wget_exist" -eq "0" ]
|
59 |
if [ "$wget_exist" -eq "0" ]
|
60 |
then
|
60 |
then
|
61 |
urpmi --no-verify-rpm --auto rpms/$ARCH/wget*.rpm
|
61 |
urpmi --no-verify-rpm --auto rpms/$ARCH/wget*.rpm
|
62 |
fi
|
62 |
fi
|
63 |
# Set the RPM repository (if not already set)
|
63 |
# Set the RPM repository (if not already set)
|
64 |
cp /etc/urpmi/urpmi.cfg /etc/urpmi/urpmi.cfg.old
|
64 |
cp /etc/urpmi/urpmi.cfg /etc/urpmi/urpmi.cfg.old
|
65 |
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l`
|
65 |
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l`
|
66 |
MIRROR_NBR=3
|
66 |
MIRROR_NBR=3
|
67 |
# For French
|
67 |
# For French
|
68 |
MIRRORLIST1="http://ftp.free.fr/mirrors/mageia.org/distrib/$VERSION/$ARCH"
|
68 |
MIRRORLIST1="http://ftp.free.fr/mirrors/mageia.org/distrib/$VERSION/$ARCH"
|
69 |
# For Europeans
|
69 |
# For Europeans
|
70 |
MIRRORLIST2="https://www.mirrorservice.org/pub/mageia/distrib/$VERSION/$ARCH"
|
70 |
MIRRORLIST2="https://www.mirrorservice.org/pub/mageia/distrib/$VERSION/$ARCH"
|
71 |
# For everybody
|
71 |
# For everybody
|
72 |
MIRRORLIST3="https://mirrors.mageia.org/api/mageia.$VERSION.$ARCH.list"
|
72 |
MIRRORLIST3="https://mirrors.mageia.org/api/mageia.$VERSION.$ARCH.list"
|
73 |
try_nb="0"; nb_repository="0"
|
73 |
try_nb="0"; nb_repository="0"
|
74 |
while [ "$nb_repository" != "4" ]
|
74 |
while [ "$nb_repository" != "4" ]
|
75 |
do
|
75 |
do
|
76 |
try_nb=`expr $try_nb + 1`
|
76 |
try_nb=`expr $try_nb + 1`
|
77 |
MIRRORLIST="MIRRORLIST$try_nb"
|
77 |
MIRRORLIST="MIRRORLIST$try_nb"
|
78 |
rpm_repository_sync
|
78 |
rpm_repository_sync
|
79 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
79 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
80 |
if [ "$nb_repository" != "4" ]
|
80 |
if [ "$nb_repository" != "4" ]
|
81 |
then
|
81 |
then
|
82 |
if [ $Lang == "fr" ]
|
82 |
if [ $Lang == "fr" ]
|
83 |
then
|
83 |
then
|
84 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
84 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
85 |
else
|
85 |
else
|
86 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
86 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
87 |
fi
|
87 |
fi
|
88 |
if [ $(expr $try_nb) -eq $MIRROR_NBR ]
|
88 |
if [ $(expr $try_nb) -eq $MIRROR_NBR ]
|
89 |
then
|
89 |
then
|
90 |
rpm_error
|
90 |
rpm_error
|
91 |
exit 1
|
91 |
exit 1
|
92 |
fi
|
92 |
fi
|
93 |
if [ $Lang == "fr" ]
|
93 |
if [ $Lang == "fr" ]
|
94 |
then
|
94 |
then
|
95 |
echo "Voulez-vous tenter une synchronisation avec un autre dépôt ? (O/n)"
|
95 |
echo "Voulez-vous tenter une synchronisation avec un autre dépôt ? (O/n)"
|
96 |
else
|
96 |
else
|
97 |
echo "Do you want to try a synchronisation with an other repository? (Y/n)"
|
97 |
echo "Do you want to try a synchronisation with an other repository? (Y/n)"
|
98 |
fi
|
98 |
fi
|
99 |
response=0
|
99 |
response=0
|
100 |
PTN='^[oOnNyY]?$'
|
100 |
PTN='^[oOnNyY]?$'
|
101 |
until [[ "$response" =~ $PTN ]]
|
101 |
until [[ "$response" =~ $PTN ]]
|
102 |
do
|
102 |
do
|
103 |
read response
|
103 |
read response
|
104 |
done
|
104 |
done
|
105 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
105 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
106 |
then
|
106 |
then
|
107 |
[ -e /etc/urpmi/urpmi.cfg.old ] && mv /etc/urpmi/urpmi.cfg.old /etc/urpmi/urpmi.cfg # restore previous rpm conf file
|
107 |
[ -e /etc/urpmi/urpmi.cfg.old ] && mv /etc/urpmi/urpmi.cfg.old /etc/urpmi/urpmi.cfg # restore previous rpm conf file
|
108 |
exit 1
|
108 |
exit 1
|
109 |
fi
|
109 |
fi
|
110 |
fi
|
110 |
fi
|
111 |
done
|
111 |
done
|
112 |
|
112 |
|
113 |
# Clean the RPM cache
|
113 |
# Clean the RPM cache
|
114 |
urpmi --clean
|
114 |
urpmi --clean
|
115 |
|
115 |
|
116 |
# At this time, we only skip Kernel update
|
116 |
# At this time, we only skip Kernel update
|
117 |
echo "/^kernel/" > /etc/urpmi/skip.list
|
117 |
echo "/^kernel/" > /etc/urpmi/skip.list
|
118 |
if [ `grep -E '^exclude=' /etc/dnf/dnf.conf |wc -l` -eq "1" ]; then
|
118 |
if [ `grep -E '^exclude=' /etc/dnf/dnf.conf |wc -l` -eq "1" ]; then
|
119 |
$SED "s?^exclude=.*?exclude=kernel\*?g" /etc/dnf/dnf.conf
|
119 |
$SED "s?^exclude=.*?exclude=kernel\*?g" /etc/dnf/dnf.conf
|
120 |
else
|
120 |
else
|
121 |
echo "exclude=kernel*" >> /etc/dnf/dnf.conf
|
121 |
echo "exclude=kernel*" >> /etc/dnf/dnf.conf
|
122 |
fi
|
122 |
fi
|
123 |
|
123 |
|
124 |
# download the kernel used by ALCASAR
|
124 |
# download the kernel used by ALCASAR
|
125 |
if [ $Lang == "fr" ]
|
125 |
if [ $Lang == "fr" ]
|
126 |
then
|
126 |
then
|
127 |
echo "Récupération du noyau Linux exploité par ALCASAR. Veuillez patienter ..."
|
127 |
echo "Récupération du noyau Linux exploité par ALCASAR. Veuillez patienter ..."
|
128 |
else
|
128 |
else
|
129 |
echo "Download the Linux kernel used by ALCASAR. Please wait ..."
|
129 |
echo "Download the Linux kernel used by ALCASAR. Please wait ..."
|
130 |
fi
|
130 |
fi
|
131 |
urpmi --auto --quiet $KERNEL
|
131 |
urpmi --auto --quiet $KERNEL
|
132 |
|
132 |
|
133 |
# download updated RPM in cache
|
133 |
# download updated RPM in cache
|
134 |
if [ $Lang == "fr" ]
|
134 |
if [ $Lang == "fr" ]
|
135 |
then
|
135 |
then
|
136 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
136 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
137 |
echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
|
137 |
echo "Il est temps d'aller prendre un café (ou une bonne bière) ;-)"
|
138 |
else
|
138 |
else
|
139 |
echo "Updated RPM download. Please wait ..."
|
139 |
echo "Updated RPM download. Please wait ..."
|
140 |
echo "You should now take a coffe (or a good beer) ;-)"
|
140 |
echo "You should now take a coffe (or a good beer) ;-)"
|
141 |
fi
|
141 |
fi
|
142 |
urpmi --auto --auto-update --quiet --test --retry 2
|
142 |
urpmi --auto --auto-update --quiet --test --retry 2
|
143 |
if [ "$?" != "0" ]
|
143 |
if [ "$?" != "0" ]
|
144 |
then
|
144 |
then
|
145 |
echo
|
145 |
echo
|
146 |
if [ $Lang == "fr" ]
|
146 |
if [ $Lang == "fr" ]
|
147 |
then
|
147 |
then
|
148 |
echo "Une erreur a été détectée lors de la récupération des paquetages."
|
148 |
echo "Une erreur a été détectée lors de la récupération des paquetages."
|
149 |
else
|
149 |
else
|
150 |
echo "An error occurs when downloading RPMS"
|
150 |
echo "An error occurs when downloading RPMS"
|
151 |
fi
|
151 |
fi
|
152 |
rpm_error
|
152 |
rpm_error
|
153 |
exit 1
|
153 |
exit 1
|
154 |
fi
|
154 |
fi
|
155 |
|
155 |
|
156 |
# update with cached RPM
|
156 |
# update with cached RPM
|
157 |
urpmi --auto --auto-update
|
157 |
urpmi --auto --auto-update
|
158 |
if [ "$?" != "0" ]
|
158 |
if [ "$?" != "0" ]
|
159 |
then
|
159 |
then
|
160 |
echo
|
160 |
echo
|
161 |
if [ $Lang == "fr" ]
|
161 |
if [ $Lang == "fr" ]
|
162 |
then
|
162 |
then
|
163 |
echo "Une erreur a été détectée lors de la mise à jour des paquetages."
|
163 |
echo "Une erreur a été détectée lors de la mise à jour des paquetages."
|
164 |
else
|
164 |
else
|
165 |
echo "An error occurs when updating packages"
|
165 |
echo "An error occurs when updating packages"
|
166 |
fi
|
166 |
fi
|
167 |
rpm_error
|
167 |
rpm_error
|
168 |
exit 1
|
168 |
exit 1
|
169 |
fi
|
169 |
fi
|
170 |
|
170 |
|
171 |
# Download of ALCASAR specifics RPM in cache (and test)
|
171 |
# Download of ALCASAR specifics RPM in cache (and test)
|
172 |
if [ $Lang == "fr" ]
|
172 |
if [ $Lang == "fr" ]
|
173 |
then
|
173 |
then
|
174 |
echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
|
174 |
echo "Récupération des paquetages complémentaires. Veuillez patienter ..."
|
175 |
else
|
175 |
else
|
176 |
echo "Download of complementary packages. Please wait ..."
|
176 |
echo "Download of complementary packages. Please wait ..."
|
177 |
fi
|
177 |
fi
|
178 |
urpmi --auto --no-recommends $PACKAGES --quiet --test --retry 2
|
178 |
urpmi --auto --no-recommends $PACKAGES --quiet --test --retry 2
|
179 |
if [ "$?" != "0" ]
|
179 |
if [ "$?" != "0" ]
|
180 |
then
|
180 |
then
|
181 |
echo
|
181 |
echo
|
182 |
if [ $Lang == "fr" ]
|
182 |
if [ $Lang == "fr" ]
|
183 |
then
|
183 |
then
|
184 |
echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires."
|
184 |
echo "Une erreur a été détectée lors de la récupération des paquetages complémentaires."
|
185 |
else
|
185 |
else
|
186 |
echo "An error occurs when downloading complementary packages"
|
186 |
echo "An error occurs when downloading complementary packages"
|
187 |
fi
|
187 |
fi
|
188 |
rpm_error
|
188 |
rpm_error
|
189 |
exit 1
|
189 |
exit 1
|
190 |
fi
|
190 |
fi
|
191 |
|
191 |
|
192 |
# update with cached RPM
|
192 |
# update with cached RPM
|
193 |
urpmi --auto --no-recommends $PACKAGES
|
193 |
urpmi --auto --no-recommends $PACKAGES
|
194 |
if [ "$?" != "0" ]
|
194 |
if [ "$?" != "0" ]
|
195 |
then
|
195 |
then
|
196 |
echo
|
196 |
echo
|
197 |
if [ $Lang == "fr" ]
|
197 |
if [ $Lang == "fr" ]
|
198 |
then
|
198 |
then
|
199 |
echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires."
|
199 |
echo "Une erreur a été détectée lors de l'installation des paquetages complémentaires."
|
200 |
else
|
200 |
else
|
201 |
echo "An error occurs when installing complementary packages"
|
201 |
echo "An error occurs when installing complementary packages"
|
202 |
fi
|
202 |
fi
|
203 |
rpm_error
|
203 |
rpm_error
|
204 |
exit 1
|
204 |
exit 1
|
205 |
fi
|
205 |
fi
|
206 |
|
206 |
|
207 |
# Keep only the kernel version we compil netflow with, and remove all others
|
207 |
# Keep only the kernel version we compil netflow with, and remove all others
|
208 |
kernelVersion=$(rpm -qa | grep -e ^kernel-server -e ^kernel-desktop)
|
208 |
kernelVersion=$(rpm -qa | grep -e ^kernel-server -e ^kernel-desktop)
|
209 |
for i in $kernelVersion
|
209 |
for i in $kernelVersion
|
210 |
do
|
210 |
do
|
211 |
if [ $i != $KERNEL ];then
|
211 |
if [ $i != $KERNEL ];then
|
212 |
urpme --auto $i
|
212 |
urpme --auto $i
|
213 |
fi
|
213 |
fi
|
214 |
done
|
214 |
done
|
215 |
|
215 |
|
216 |
# delete unused RPMs
|
216 |
# delete unused or not usefull RPMs
|
217 |
if [ $Lang == "fr" ]
|
217 |
if [ $Lang == "fr" ]
|
218 |
then
|
218 |
then
|
219 |
echo "Cleaning the system : "
|
219 |
echo "Cleaning the system : "
|
220 |
else
|
220 |
else
|
221 |
echo "Nettoyage du système : "
|
221 |
echo "Nettoyage du système : "
|
222 |
fi
|
222 |
fi
|
223 |
unused_rpm="shorewall mandi plymouth squid polkit pm-utils dnsmasq clamav clamd clamav-db"
|
223 |
unused_rpm="shorewall mandi plymouth squid polkit pm-utils dnsmasq clamav clamd clamav-db tracker"
|
224 |
/usr/sbin/urpme --auto -a $unused_rpm
|
224 |
/usr/sbin/urpme --auto -a $unused_rpm
|
225 |
for distrib in mga7 mga8
|
225 |
for distrib in mga7 mga8
|
226 |
do
|
226 |
do
|
227 |
for rpm in `rpm -qa|grep $distrib`; do urpme --auto $rpm; done
|
227 |
for rpm in `rpm -qa|grep $distrib`; do urpme --auto $rpm; done
|
228 |
done
|
228 |
done
|
229 |
/usr/sbin/urpme --auto --auto-orphans
|
229 |
/usr/sbin/urpme --auto --auto-orphans
|
230 |
|
230 |
|
231 |
# Save chilli launch script (erase with new rpm one)
|
231 |
# Save chilli launch script (erase with new rpm one)
|
232 |
[ -e /etc/chilli.conf ] && cp /etc/chilli.conf /tmp/
|
232 |
[ -e /etc/chilli.conf ] && cp /etc/chilli.conf /tmp/
|
233 |
# Install home made RPMs
|
233 |
# Install home made RPMs
|
234 |
for pkg in `ls rpms/$ARCH/*.rpm|grep -v wget`
|
234 |
for pkg in `ls rpms/$ARCH/*.rpm|grep -v wget`
|
235 |
do
|
235 |
do
|
236 |
urpmi --no-verify --auto $pkg
|
236 |
urpmi --no-verify --auto $pkg
|
237 |
done
|
237 |
done
|
238 |
# restore chilli launch script
|
238 |
# restore chilli launch script
|
239 |
[ -e /tmp/chilli.conf ] && mv /tmp/chilli.conf /etc/
|
239 |
[ -e /tmp/chilli.conf ] && mv /tmp/chilli.conf /etc/
|
240 |
|
240 |
|
241 |
# Clean the RPM cache
|
241 |
# Clean the RPM cache
|
242 |
urpmi --clean
|
242 |
urpmi --clean
|
243 |
# the ipt-netflow RPM add the kernel module ipt_NETFLOW (the modules dependance tree need to be updated). "2>/dev/null" in order not to display a error (the running kernel is not the ALCASAR one during the installation process)
|
243 |
# the ipt-netflow RPM add the kernel module ipt_NETFLOW (the modules dependance tree need to be updated). "2>/dev/null" in order not to display a error (the running kernel is not the ALCASAR one during the installation process)
|
244 |
/sbin/depmod -a 2>/dev/null
|
244 |
/sbin/depmod -a 2>/dev/null
|
245 |
# test if all needed rpms are correctly installed
|
245 |
# test if all needed rpms are correctly installed
|
246 |
count_pkg=0; nb_pkg=0;
|
246 |
count_pkg=0; nb_pkg=0;
|
247 |
for pkg in $PACKAGES
|
247 |
for pkg in $PACKAGES
|
248 |
do
|
248 |
do
|
249 |
nb_pkg=`expr $nb_pkg + 1`
|
249 |
nb_pkg=`expr $nb_pkg + 1`
|
250 |
if rpm -q --quiet $pkg ; then
|
250 |
if rpm -q --quiet $pkg ; then
|
251 |
count_pkg=`expr $count_pkg + 1`
|
251 |
count_pkg=`expr $count_pkg + 1`
|
252 |
else
|
252 |
else
|
253 |
echo "error installing $pkg"
|
253 |
echo "error installing $pkg"
|
254 |
fi
|
254 |
fi
|
255 |
done
|
255 |
done
|
256 |
if [ $count_pkg -ne $nb_pkg ]
|
256 |
if [ $count_pkg -ne $nb_pkg ]
|
257 |
then
|
257 |
then
|
258 |
exit 1
|
258 |
exit 1
|
259 |
fi
|
259 |
fi
|
260 |
|
260 |
|
261 |
# test if all custom rpms are correctly installed
|
261 |
# test if all custom rpms are correctly installed
|
262 |
count_pkg=0; nb_pkg=0;
|
262 |
count_pkg=0; nb_pkg=0;
|
263 |
for pkg in `ls rpms/$ARCH/|sed 's/.x86_64.rpm//'`
|
263 |
for pkg in `ls rpms/$ARCH/|sed 's/.x86_64.rpm//'`
|
264 |
do
|
264 |
do
|
265 |
nb_pkg=`expr $nb_pkg + 1`
|
265 |
nb_pkg=`expr $nb_pkg + 1`
|
266 |
if rpm -q --quiet $pkg ; then
|
266 |
if rpm -q --quiet $pkg ; then
|
267 |
count_pkg=`expr $count_pkg + 1`
|
267 |
count_pkg=`expr $count_pkg + 1`
|
268 |
else
|
268 |
else
|
269 |
echo "error installing $pkg"
|
269 |
echo "error installing $pkg"
|
270 |
fi
|
270 |
fi
|
271 |
done
|
271 |
done
|
272 |
if [ $count_pkg -ne $nb_pkg ]
|
272 |
if [ $count_pkg -ne $nb_pkg ]
|
273 |
then
|
273 |
then
|
274 |
exit 1
|
274 |
exit 1
|
275 |
fi
|
275 |
fi
|
276 |
|
276 |
|
277 |
# .rpmnew handling (unused with ALCASAR)
|
277 |
# .rpmnew handling (unused with ALCASAR)
|
278 |
[ -e /etc/shadow.rpmnew ] && rm -f /etc/shadow.rpmnew
|
278 |
[ -e /etc/shadow.rpmnew ] && rm -f /etc/shadow.rpmnew
|
279 |
[ -e /etc/sysconfig/system.rpmnew ] && rm -f /etc/sysconfig/system.rpmnew
|
279 |
[ -e /etc/sysconfig/system.rpmnew ] && rm -f /etc/sysconfig/system.rpmnew
|
280 |
[ -e /etc/rpm/macros.rpmnew ] && rm -f /etc/rpm/macros.rpmnew
|
280 |
[ -e /etc/rpm/macros.rpmnew ] && rm -f /etc/rpm/macros.rpmnew
|
281 |
[ -e /etc/fstab.rpmnew ] && rm -f /etc/fstab.rpmnew
|
281 |
[ -e /etc/fstab.rpmnew ] && rm -f /etc/fstab.rpmnew
|
282 |
[ -e /etc/shells.rpmnew ] && rm -f /etc/shells.rpmnew
|
282 |
[ -e /etc/shells.rpmnew ] && rm -f /etc/shells.rpmnew
|
283 |
[ -e /etc/hosts.rpmnew ] && rm -f /etc/hosts.rpmnew
|
283 |
[ -e /etc/hosts.rpmnew ] && rm -f /etc/hosts.rpmnew
|
284 |
[ -e /etc/systemd/journald.conf.rpmnew ] && rm -f /etc/systemd/journald.conf.rpmnew
|
284 |
[ -e /etc/systemd/journald.conf.rpmnew ] && rm -f /etc/systemd/journald.conf.rpmnew
|
285 |
[ -e /etc/raddb/certs/dh.rpmnew ] && rm -f /etc/raddb/certs/dh.rpmnew
|
285 |
[ -e /etc/raddb/certs/dh.rpmnew ] && rm -f /etc/raddb/certs/dh.rpmnew
|
286 |
|
286 |
|
287 |
# .rpmnew handling (used with ALCASAR)
|
287 |
# .rpmnew handling (used with ALCASAR)
|
288 |
[ -e /etc/php.ini.rpmnew ] && mv -f /etc/php.ini.rpmnew /etc/php.ini.default
|
288 |
[ -e /etc/php.ini.rpmnew ] && mv -f /etc/php.ini.rpmnew /etc/php.ini.default
|
289 |
[ -e /etc/lighttpd/lighttpd.conf.rpmnew ] && mv -f /etc/lighttpd/lighttpd.conf.rpmnew /etc/lighttpd/lighttpd.conf.default
|
289 |
[ -e /etc/lighttpd/lighttpd.conf.rpmnew ] && mv -f /etc/lighttpd/lighttpd.conf.rpmnew /etc/lighttpd/lighttpd.conf.default
|
290 |
[ -e /etc/lighttpd/modules.conf.rpmnew ] && mv -f /etc/lighttpd/modules.conf.rpmnew /etc/lighttpd/modules.conf.default
|
290 |
[ -e /etc/lighttpd/modules.conf.rpmnew ] && mv -f /etc/lighttpd/modules.conf.rpmnew /etc/lighttpd/modules.conf.default
|
291 |
[ -e /etc/e2guardian/e2guardian.conf.rpmnew ] && mv -f /etc/e2guardian/e2guardian.conf.rpmnew /etc/e2guardian/e2guardian.conf.default
|
291 |
[ -e /etc/e2guardian/e2guardian.conf.rpmnew ] && mv -f /etc/e2guardian/e2guardian.conf.rpmnew /etc/e2guardian/e2guardian.conf.default
|
292 |
[ -e /etc/e2guardian/e2guardianf1.conf.rpmnew ] && mv -f /etc/e2guardian/e2guardianf1.conf.rpmnew /etc/e2guardian/e2guardianf1.conf.default
|
292 |
[ -e /etc/e2guardian/e2guardianf1.conf.rpmnew ] && mv -f /etc/e2guardian/e2guardianf1.conf.rpmnew /etc/e2guardian/e2guardianf1.conf.default
|
293 |
[ -e /etc/e2guardian/lists/urlregexplist.rpmnew ] && mv -f /etc/e2guardian/lists/urlregexplist.rpmnew /etc/e2guardian/lists/urlregexplist.default
|
293 |
[ -e /etc/e2guardian/lists/urlregexplist.rpmnew ] && mv -f /etc/e2guardian/lists/urlregexplist.rpmnew /etc/e2guardian/lists/urlregexplist.default
|
294 |
[ -e /etc/e2guardian/lists/bannedregexpurllist.rpmnew ] && mv -f /etc/e2guardian/lists/bannedregexpurllist.rpmnew /etc/e2guardian/lists/bannedregexpurllist.default
|
294 |
[ -e /etc/e2guardian/lists/bannedregexpurllist.rpmnew ] && mv -f /etc/e2guardian/lists/bannedregexpurllist.rpmnew /etc/e2guardian/lists/bannedregexpurllist.default
|
295 |
[ -e /etc/vnstat.conf.rpmnew ] && mv -f /etc/vnstat.conf.rpmnew /etc/vnstat.conf.default
|
295 |
[ -e /etc/vnstat.conf.rpmnew ] && mv -f /etc/vnstat.conf.rpmnew /etc/vnstat.conf.default
|
296 |
[ -e /etc/fail2ban/jail.conf.rpmnew ] && mv -f /etc/fail2ban/jail.conf.rpmnew /etc/fail2ban/jail.conf.default
|
296 |
[ -e /etc/fail2ban/jail.conf.rpmnew ] && mv -f /etc/fail2ban/jail.conf.rpmnew /etc/fail2ban/jail.conf.default
|
297 |
[ -e /etc/ssh/sshd_config.rpmnew ] && mv -f /etc/ssh/sshd_config.rpmnew /etc/ssh/sshd_config.default
|
297 |
[ -e /etc/ssh/sshd_config.rpmnew ] && mv -f /etc/ssh/sshd_config.rpmnew /etc/ssh/sshd_config.default
|
298 |
|
298 |
|
299 |
exit 0
|
299 |
exit 0
|
300 |
|
300 |
|