1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-urpmi.sh 2937 2021-04-05 22:17:52Z rexy $
|
2 |
# $Id: alcasar-urpmi.sh 2939 2021-04-07 22:20:08Z rexy $
|
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="7"
|
12 |
VERSION="7"
|
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-5.10.14-1.mga7-1-1.mga7"
|
15 |
KERNEL="kernel-server-5.10.27-1.mga7-1-1.mga7"
|
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" : needed by phpsysinfo
|
19 |
# "lsscsi" & nvme-cli" : 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 |
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-rrd unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamd fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat"
|
22 |
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-rrd unbound e2guardian postfix mariadb ntp bind-utils openssh-server rng-utils rsync clamd fail2ban gnupg2 ulogd pm-fallback-policy ipset usb_modeswitch vnstat dos2unix p7zip msec kernel-userspace-headers kernel-firmware-nonfree dnsmasq dhcp-server tcpdump fonts-dejavu-common fonts-ttf-dejavu lsscsi nvme-cli sudo socat"
|
23 |
|
23 |
|
24 |
rpm_repository_sync ()
|
24 |
rpm_repository_sync ()
|
25 |
{
|
25 |
{
|
26 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
26 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
27 |
{
|
27 |
{
|
28 |
downloader: wget
|
28 |
downloader: wget
|
29 |
}
|
29 |
}
|
30 |
EOF
|
30 |
EOF
|
31 |
echo ${!MIRRORLIST}
|
31 |
echo ${!MIRRORLIST}
|
32 |
urpmi.addmedia core --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/release
|
32 |
urpmi.addmedia core --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/release
|
33 |
urpmi.addmedia core-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/updates
|
33 |
urpmi.addmedia core-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/updates
|
34 |
urpmi.addmedia nonfree --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/release
|
34 |
urpmi.addmedia nonfree --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/release
|
35 |
urpmi.addmedia nonfree-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/updates
|
35 |
urpmi.addmedia nonfree-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/nonfree/updates
|
36 |
}
|
36 |
}
|
37 |
|
37 |
|
38 |
rpm_error ()
|
38 |
rpm_error ()
|
39 |
{
|
39 |
{
|
40 |
echo
|
40 |
echo
|
41 |
if [ $Lang == "fr" ]
|
41 |
if [ $Lang == "fr" ]
|
42 |
then
|
42 |
then
|
43 |
echo "Relancez l'installation ultérieurement."
|
43 |
echo "Relancez l'installation ultérieurement."
|
44 |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
|
44 |
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
|
45 |
else
|
45 |
else
|
46 |
echo "Try an other install later."
|
46 |
echo "Try an other install later."
|
47 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
|
47 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
|
48 |
fi
|
48 |
fi
|
49 |
}
|
49 |
}
|
50 |
|
50 |
|
51 |
# extract the current Mageia version and hardware architecture (i586 ou X64)
|
51 |
# extract the current Mageia version and hardware architecture (i586 ou X64)
|
52 |
fic=`cat /etc/product.id`
|
52 |
fic=`cat /etc/product.id`
|
53 |
old="$IFS"
|
53 |
old="$IFS"
|
54 |
IFS=","
|
54 |
IFS=","
|
55 |
set $fic
|
55 |
set $fic
|
56 |
for i in $*
|
56 |
for i in $*
|
57 |
do
|
57 |
do
|
58 |
if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ]
|
58 |
if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ]
|
59 |
then
|
59 |
then
|
60 |
DISTRIBUTION=`echo $i|cut -d"=" -f2`
|
60 |
DISTRIBUTION=`echo $i|cut -d"=" -f2`
|
61 |
fi
|
61 |
fi
|
62 |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
|
62 |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
|
63 |
then
|
63 |
then
|
64 |
CURRENT_VERSION=`echo $i|cut -d"=" -f2`
|
64 |
CURRENT_VERSION=`echo $i|cut -d"=" -f2`
|
65 |
fi
|
65 |
fi
|
66 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
66 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
67 |
then
|
67 |
then
|
68 |
ARCH=`echo $i|cut -d"=" -f2`
|
68 |
ARCH=`echo $i|cut -d"=" -f2`
|
69 |
fi
|
69 |
fi
|
70 |
done
|
70 |
done
|
71 |
IFS="$old"
|
71 |
IFS="$old"
|
72 |
|
72 |
|
73 |
# We prefer wget than curl
|
73 |
# We prefer wget than curl
|
74 |
urpmi --no-verify-rpm --auto rpms/$ARCH/wget*.rpm
|
74 |
urpmi --no-verify-rpm --auto rpms/$ARCH/wget*.rpm
|
75 |
|
75 |
|
76 |
# Set the RPM repository (if not already set)
|
76 |
# Set the RPM repository (if not already set)
|
77 |
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l`
|
77 |
ACTIVE_REPO=`cat /etc/urpmi/urpmi.cfg|grep "mageia.org"|wc -l`
|
78 |
MIRROR_NBR=2
|
78 |
MIRROR_NBR=2
|
79 |
# For Europeans
|
79 |
# For Europeans
|
80 |
MIRRORLIST1="https://www.mirrorservice.org/pub/mageia/distrib/$VERSION/$ARCH"
|
80 |
MIRRORLIST1="https://www.mirrorservice.org/pub/mageia/distrib/$VERSION/$ARCH"
|