-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall-all-dependencies.sh
executable file
·57 lines (49 loc) · 1.42 KB
/
install-all-dependencies.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
#!/usr/bin/env bash
set -eu
saved_pwd="$(pwd -P)"
function determine_distro() {
lsb_release="$(which lsb_release 2> /dev/null)"
if [[ -n "${lsb_release}" ]]; then
echo "$(lsb_release -is)"
return
fi
if [[ -f '/etc/centos-release' ]]; then
echo 'CentOS'
return
fi
if [[ -f '/etc/fedora-release' ]]; then
echo 'Fedora'
return
fi
}
function determine_release() {
distro="$1"
if [[ "${distro}" = 'CentOS' ]]; then
sudo yum install -y redhat-lsb-core
fi
lsb_release="$(which lsb_release)"
if [[ -n "${lsb_release}" ]]; then
echo "$(${lsb_release} -rs)"
else
echo "Error: Please make sure that 'lsb_release' is available on your system!" >&2
exit 2
fi
}
distro="$(determine_distro)"
release="$(determine_release "${distro}")"
install_dependencies=''
if [[ "${distro}" = 'Ubuntu' || "${distro}" = 'Kali' ]]; then
install_dependencies='install-ubuntu-dependencies.sh'
elif [[ "${distro}" = 'CentOS' ]]; then
sudo yum install -y redhat-lsb-core
install_dependencies='install-centos-dependencies.sh'
elif [[ "${distro}" = 'Fedora' ]]; then
sudo dnf install -y lsb_release
install_dependencies='install-fedora-dependencies.sh'
else
echo 'Your distribution is not yet supported by this script.' >&2
exit 1
fi
here=$(dirname $(readlink -e $0))
${here}/${install_dependencies}
cd "${saved_pwd}"