forked from iamvazu/ytviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·126 lines (122 loc) · 2.56 KB
/
install.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env bash
[[ $EUID -ne 0 ]] && exec sudo "$0" "$@"
case "$(uname -s)" in
Linux)
if [[ ! -z "$(which apt 2>/dev/null)" ]]; then
install="sudo apt install -y"
commands=$(cat<<-EOT
sudo apt update -y && sudo apt upgrade -y
sudo apt install python -y
EOT
)
elif [[ ! -z "$(which pacman 2>/dev/null)" ]]; then
install="sudo pacman -S --noconfirm"
commands=$(cat<<-EOT
sudo pacman -Syu --noconfirm
sudo pacman -S python --noconfirm
EOT
)
else
echo "Can't find package manager."
exit 1
fi
echo "Select python package installer."
options=("PIP" "Easy Install")
select option in "${options[@]}"
do
case $option in
"PIP")
commands=$(cat<<-EOT
$commands
$install python-pip
sudo pip install -r requirements.txt
EOT
)
break
;;
"Easy Install")
commands=$(cat<<-EOT
$commands
$install python-setuptools
sudo easy_install \$(cat requirements.txt)
EOT
)
break
;;
esac
done
echo "Select browser for the bot."
options=("Google Chrome" "Mozilla Firefox")
select option in "${options[@]}"
do
case $option in
"Google Chrome")
commands=$(cat<<-EOT
$commands
$install chromium
EOT
)
break
;;
"Mozilla Firefox")
if [[ "$(uname -m)" == "x86_64" ]]; then
arch=32
else
arch=64
fi
commands=$(cat<<-EOT
$commands
wget "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux$arch.tar.gz"
tar -xvzf geckodriver*
sudo chmod +x geckodriver
sudo mv geckodriver /usr/bin
sudo rm geckodriver*
EOT
)
break
;;
esac
done
;;
Darwin)
commands=$(cat<<-EOT
brew update && brew upgrade
brew install python
pip install -r requirements.txt
EOT
)
echo "Select browser for the bot."
options=("Google Chrome" "Mozilla Firefox")
select option in "${options[@]}"
do
case $option in
"Google Chrome")
commands=$(cat<<-EOT
$commands
brew install chromium
EOT
)
break
;;
"Mozilla Firefox")
commands=$(cat<<-EOT
$commands
wget "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz"
tar -xvzf geckodriver*
sudo chmod +x geckodriver
sudo mv geckodriver /usr/bin
sudo rm geckodriver*
EOT
)
break
;;
esac
done
;;
*)
echo "Your OS is not supported."
exit 1
;;
esac
eval "${commands}"
echo "Successfully installed YTViewer."