-
Notifications
You must be signed in to change notification settings - Fork 5
/
shell_tools.sh
executable file
·37 lines (25 loc) · 1.05 KB
/
shell_tools.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
#!/usr/bin/env bash
## Tools to install
TOOLS=("speedtest" "iperf3" "fping")
## Taking OS type
OS_TYPE=$(uname)
## Running OS-depndent install
if [[ ${OS_TYPE} == "Linux" ]]; then
OS_SUBTYPE=$(cat /etc/os-release | awk 'BEGIN {FS="="} /^ID=/ {print $2}' | sed -e 's/"//g')
OS_VERSION=$(cat /etc/os-release | awk 'BEGIN {FS="="} /^VERSION_ID=/ {print $2}' | sed -e 's/"//g')
echo "$(date): Starting installation of ${TOOLS[@]} at ${OS_SUBTYPE} ${OS_VERSION}"
if [[ ${OS_SUBTYPE} == "centos" && ${OS_VERSION} == "8" ]]; then
sudo dnf -y install ${TOOLS[@]}
elif [[ ${OS_SUBTYPE} == "centos" && ${OS_VERSION} == "7" ]]; then
sudo yum -y install ${TOOLS[@]}
elif [[ ${OS_SUBTYPE} == "ubuntu" || ${OS_SUBTYPE} == "debian" ]]; then
sudo apt-get -y install ${TOOLS[@]}
else
echo "UNSUPPORTED LINUX TYPE"
fi
elif [[ ${OS_TYPE} == "Darwin" ]]; then
echo "$(date): Starting installation of ${TOOLS[@]} at ${OS_SUBTYPE} ${OS_VERSION}"
brew -y install ${TOOLS[@]}
else
echo "UNSUPPORTED OS TYPE"
fi