| Line 1... |
Line 1... |
| 1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
| 2 |
# $Id: alcasar-rpm-download.sh 2236 2017-05-19 21:58:25Z tom.houdayer $
|
2 |
# $Id: alcasar-rpm-download.sh 2454 2017-12-09 18:59:31Z tom.houdayer $
|
| 3 |
|
3 |
|
| 4 |
# alcasar-urpmi.sh
|
4 |
# alcasar-urpmi.sh
|
| 5 |
# by Franck BOUIJOUX and Richard REY
|
5 |
# by Franck BOUIJOUX and Richard REY
|
| 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 |
# récupération des RPM nécessaires dans un fichier tarball
|
8 |
# récupération des RPM nécessaires dans un fichier tarball
|
| 9 |
# retrieve needed RPM in a tarball file
|
9 |
# retrieve needed RPM in a tarball file
|
| 10 |
|
10 |
|
| 11 |
VERSION="5"
|
11 |
VERSION="5"
|
| 12 |
ARCH="x86_64"
|
12 |
ARCH="x86_64"
|
| 13 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
13 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
| 14 |
PACKAGES="arp-scan vim-enhanced freeradius freeradius-mysql freeradius-ldap apache apache-mod_ssl apache-mod_php dansguardian postfix mariadb ntp bind-utils openssh-server php-xml php-ldap 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 man kernel-firmware-nonfree dos2unix p7zip bc msec kernel-userspace-headers"
|
14 |
PACKAGES="arp-scan vim-enhanced freeradius freeradius-mysql freeradius-ldap apache apache-mod_ssl apache-mod_php dansguardian postfix mariadb ntp bind-utils openssh-server php-xml php-ldap 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 man kernel-firmware-nonfree dos2unix p7zip bc msec kernel-userspace-headers"
|
| 15 |
|
15 |
|
| 16 |
rpm_repository_sync ()
|
16 |
rpm_repository_sync ()
|
| 17 |
{
|
17 |
{
|
| Line 41... |
Line 41... |
| 41 |
IFS=","
|
41 |
IFS=","
|
| 42 |
set $fic
|
42 |
set $fic
|
| 43 |
for i in $*
|
43 |
for i in $*
|
| 44 |
do
|
44 |
do
|
| 45 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
45 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
| 46 |
then
|
46 |
then
|
| 47 |
ARCH=`echo $i|cut -d"=" -f2`
|
47 |
ARCH=`echo $i|cut -d"=" -f2`
|
| 48 |
fi
|
48 |
fi
|
| 49 |
done
|
49 |
done
|
| 50 |
IFS="$old"
|
50 |
IFS="$old"
|
| 51 |
# We prefer wget than curl
|
51 |
# We prefer wget than curl
|
| Line 63... |
Line 63... |
| 63 |
try_nb="0"; nb_repository="0"
|
63 |
try_nb="0"; nb_repository="0"
|
| 64 |
while [ "$nb_repository" != "4" ]
|
64 |
while [ "$nb_repository" != "4" ]
|
| 65 |
do
|
65 |
do
|
| 66 |
try_nb=`expr $try_nb + 1`
|
66 |
try_nb=`expr $try_nb + 1`
|
| 67 |
MIRRORLIST="MIRRORLIST$try_nb"
|
67 |
MIRRORLIST="MIRRORLIST$try_nb"
|
| 68 |
rpm_repository_sync
|
68 |
rpm_repository_sync
|
| 69 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
69 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
| 70 |
if [ "$nb_repository" != "4" ]
|
70 |
if [ "$nb_repository" != "4" ]
|
| 71 |
then
|
71 |
then
|
| 72 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
72 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
| 73 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
73 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
| Line 82... |
Line 82... |
| 82 |
PTN='^[oOnNyY]$'
|
82 |
PTN='^[oOnNyY]$'
|
| 83 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
83 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
| 84 |
do
|
84 |
do
|
| 85 |
read response
|
85 |
read response
|
| 86 |
done
|
86 |
done
|
| 87 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
87 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
| 88 |
then
|
88 |
then
|
| 89 |
exit 1
|
89 |
exit 1
|
| 90 |
fi
|
90 |
fi
|
| 91 |
fi
|
91 |
fi
|
| 92 |
done
|
92 |
done
|
| Line 96... |
Line 96... |
| 96 |
do
|
96 |
do
|
| 97 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
97 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
| 98 |
echo -n "."
|
98 |
echo -n "."
|
| 99 |
done
|
99 |
done
|
| 100 |
urpmi --clean
|
100 |
urpmi --clean
|
| 101 |
# download RPM in cache
|
101 |
# download RPM in cache
|
| 102 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
102 |
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
|
| 103 |
echo "Updated RPM download. Please wait ..."
|
103 |
echo "Updated RPM download. Please wait ..."
|
| 104 |
echo "Il est temps d'aller prendre un café :-) "
|
104 |
echo "Il est temps d'aller prendre un café :-) "
|
| 105 |
echo "You should now take a Beer ;-) "
|
105 |
echo "You should now take a Beer ;-) "
|
| 106 |
urpmi --auto --auto-update --quiet --test --retry 2
|
106 |
urpmi --auto --auto-update --quiet --test --retry 2
|