-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure_linux.sh
executable file
·70 lines (63 loc) · 2.56 KB
/
configure_linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LOGFILE="/var/log/configure_linux.log"
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS="suse"
elif [ -f /etc/almalinux-release ]; then
# Almalinux.
OS="almalinux"
VER=$(grep -o "[0-9]" /etc/almalinux-release | head -1)
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
OS="centos"
VER=$(grep -o "[0-9]" /etc/redhat-release | head -1)
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
echo "Sistema operativo detectado: $OS, versión: $VER"
echo ""
if echo $OS | grep -i "centos" > /dev/null; then
echo "Ejecutando script para CentOS..."
yum install wget -y
wget https://raw.githubusercontent.com/wnpower/Linux-Config/master/configure_centos.sh -O /tmp/configure_centos.sh
bash /tmp/configure_centos.sh "$@" 2>&1 | tee "$LOGFILE"
elif echo $OS | grep -i "almalinux" > /dev/null; then
echo "Ejecutando script para Almalinux..."
yum install wget -y
wget https://raw.githubusercontent.com/wnpower/Linux-Config/master/configure_almalinux.sh -O /tmp/configure_almalinux.sh
bash /tmp/configure_almalinux.sh "$@" 2>&1 | tee "$LOGFILE"
elif echo $OS | grep -i "debian" > /dev/null; then
echo "Ejecutando script para Debian..."
apt install wget -y
wget https://raw.githubusercontent.com/wnpower/Linux-Config/master/configure_debian.sh -O /tmp/configure_debian.sh
bash /tmp/configure_debian.sh "$@" 2>&1 | tee "$LOGFILE"
elif echo $OS | grep -i "ubuntu" > /dev/null; then
echo "Ejecutando script para Ubuntu..."
apt install wget -y
wget https://raw.githubusercontent.com/wnpower/Linux-Config/master/configure_ubuntu.sh -O /tmp/configure_ubuntu.sh
bash /tmp/configure_ubuntu.sh "$@" 2>&1 | tee "$LOGFILE"
fi
history -c
echo "" > /root/.bash_history