This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
89 lines (81 loc) · 2.97 KB
/
setup.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
OS=`uname -s`
REV=`uname -r`
MACH=`uname -m`
GetVersionFromFile() {
VERSION="$(tr "\n" ' ' < cat "$1" | sed s/.*VERSION.*=\ // )"
}
if [ "${OS}" = "SunOS" ] ; then
OS=Solaris
ARCH=$(uname -p)
OSSTR="${OS} ${REV}(${ARCH} $(uname -v)"
echo ${OSSTR}
echo Unsupported
return
elif [ "${OS}" = "AIX" ] ; then
OSSTR="${OS} $(oslevel) ($(oslevel -r)"
echo ${OSSTR}
echo Unsupported
return
elif [ "${OS}" = "Linux" ] ; then
KERNEL=$(uname -r)
if [ -f /etc/redhat-release ] ; then
DIST='RedHat'
PSUEDONAME=$(sed s/.*\(// < /etc/redhat-release | sed s/\)//)
REV=$(sed s/.*release\ // < /etc/redhat-release | sed s/\ .*//)
echo Unsupported
elif [ -f /etc/SuSE-release ] ; then
DIST=$(tr "\n" ' ' < /etc/SuSE-release | sed s/VERSION.*//)
REV=$(tr "\n" ' ' < /etc/SuSE-release| sed s/.*=\ //)
echo Unsupported
elif [ -f /etc/mandrake-release ] ; then
DIST='Mandrake'
PSUEDONAME=$(sed s/.*\(// < /etc/mandrake-release | sed s/\)//)
REV=$(sed s/.*release\ // < /etc/mandrake-release | sed s/\ .*//)
echo Unsupported
elif [ -f /etc/debian_version ] ; then
if [ "$(awk -F= '/DISTRIB_ID/ {print $2}' /etc/lsb-release)" = "Ubuntu" ]; then
DIST="Ubuntu"
echo Debian-based script:
echo Refresh repos...
$(sudo apt update -y > log/i-log.log 2>&1)
$(sudo apt autoremove -y >> log/i-log.log 2>&1)
echo Installing Python...
$(sudo apt install -y python3 >> log/i-log.log 2>&1)
echo Installing pip...
$(sudo apt install -y python3-pip >> log/i-log.log 2>&1)
echo Installing necessary packages:
$(sudo pip install -r requirements.txt >> log/i-log.log 2>&1)
else
DIST="Debian $(cat /etc/debian_version)"
REV=""
echo Debian-based script:
echo Refresh repos...
$(sudo apt update -y > log/i-log.log 2>&1)
$(sudo apt autoremove -y >> log/i-log.log 2>&1)
echo Installing Python...
$(sudo apt install -y python3 >> log/i-log.log 2>&1)
echo Installing pip...
$(sudo apt install -y python3-pip >> log/i-log.log 2>&1)
echo Installing necessary packages:
$(sudo pip install -r requirements.txt >> log/i-log.log 2>&1)
fi
elif [ -f /etc/arch-release ] ; then
DIST="Arch"
echo Arch-based script:
echo Refresh repos...
$(sudo pacmam -Syyuu --noconfirm > log/i-log.log 2>&1)
echo Installing Python...
$(sudo pacman -S python3 --noconfirm>> log/i-log.log 2>&1)
echo Installing pip...
$(sudo pacman -S python-pip --noconfirm>> log/i-log.log 2>&1)
echo Installing necessary packages:
$(sudo pip install -r requirements.txt >> log/i-log.log 2>&1)
fi
if [ -f /etc/UnitedLinux-release ] ; then
DIST="${DIST}[$(tr "\n" ' ' < /etc/UnitedLinux-release | sed s/VERSION.*//)]"
fi
OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})"
#echo Your distro: ${OSSTR}
fi
exit 1