-
Notifications
You must be signed in to change notification settings - Fork 47
/
nadekoautoinstaller.sh
228 lines (215 loc) · 7.72 KB
/
nadekoautoinstaller.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/bin/bash -e
function detect_OS_ARCH_VER_BITS {
ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/')
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
VER=$(cat /etc/debian_version)
SVER=$( cat /etc/debian_version | grep -oP "[0-9]+" | head -1 )
elif [ -f /etc/centos-release ]; then
OS=CentOS
VER=$( cat /etc/centos-release | grep -oP "[0-9]+" | head -1 )
elif [ -f /etc/arch-release ]; then
OS=ArchLinux
VER=$(uname -r)
else
OS=$(uname -s)
VER=$(uname -r)
fi
case $(uname -m) in
x86_64)
BITS=64
;;
i*86)
BITS=32
;;
armv*)
BITS=32
;;
*)
BITS=?
;;
esac
case $(uname -m) in
x86_64)
ARCH=x64 # or AMD64 or Intel64 or whatever
;;
i*86)
ARCH=x86 # or IA32 or Intel32 or whatever
;;
*)
# leave ARCH as-is
;;
esac
}
declare OS ARCH VER BITS
detect_OS_ARCH_VER_BITS
export OS ARCH VER BITS
if [ "$BITS" = 32 ]; then
echo -e "Your system architecture is $ARCH which is unsupported to run Microsoft .NET Core SDK. \nYour OS: $OS \nOS Version: $VER"
echo
printf "\e[1;31mPlease check the NadekoBot self-hosting guide for alternatives.\e[0m\n"
rm nadekoautoinstaller.sh
exit 1
fi
if [ "$OS" = "Ubuntu" ]; then
if [ "$VER" = "12.04" ]; then
supported=0
elif [ "$VER" = "14.04" ]; then
supported=1
elif [ "$VER" = "16.04" ]; then
supported=1
elif [ "$VER" = "16.10" ]; then
supported=1
elif [ "$VER" = "17.04" ]; then
supported=1
else
supported=0
fi
elif [ "$OS" = "ArchLinux" ]; then
supported=1
fi
if [ "$supported" = 0 ]; then
echo -e "Your OS $OS $VER $ARCH looks unsupported to run Microsoft .NET Core. \nExiting..."
printf "\e[1;31mContact NadekoBot's support on Discord with screenshot.\e[0m\n"
rm nadekoautoinstaller.sh
exit 1
fi
if [ "$OS" = "Linux" ]; then
echo -e "Your OS $OS $VER $ARCH probably can run Microsoft .NET Core. \nContact NadekoBot's support on Discord with screenshot."
rm nadekoautoinstaller.sh
exit 1
fi
echo -e "Welcome to NadekoBot Auto Prerequisites Installer. \nWould you like to continue? \nYour OS: $OS \nOS Version: $VER \nArchitecture: $ARCH"
while true; do
read -p "[y/n]: " yn
case $yn in
[Yy]* ) clear; echo Running NadekoBot Auto-Installer; sleep 2; break;;
[Nn]* ) echo Quitting...; rm nadekoautoinstaller.sh && exit;;
* ) echo "Couldn't get that please type [y] for Yes or [n] for No.";;
esac
done
if [ "$OS" = "Ubuntu" ]; then
echo "This installer will download all of the required packages for NadekoBot. It will use about 350MB of space. This might take awhile to download if you do not have a good internet connection."
echo ""
read -n 1 -s -p "Press any key to continue..."
if [ "$VER" = "14.04" ]; then
echo "Gwen was here <3"
echo "Preparing..."
sudo apt-get install software-properties-common apt-transport-https -y
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo add-apt-repository ppa:mc3man/trusty-media -y
sudo add-apt-repository ppa:chris-lea/libsodium -y
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
echo "Installing Git..."
sudo apt install git -y
echo "Installing .NET Core..."
sudo apt install dotnet-dev-1.0.0-preview2.1-003177 -y
echo "Installing prerequisites..."
sudo apt install libopus0 opus-tools libopus-dev libsodium-dev ffmpeg tmux -y
elif [ "$VER" = "16.04" ]; then
echo ""
echo "Preparing..."
sudo apt-get install software-properties-common apt-transport-https -y
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
echo "Installing Git..."
sudo apt install git -y
echo "Installing .NET Core..."
sudo apt install dotnet-dev-1.0.0-preview2.1-003177 -y
echo "Installing prerequisites..."
sudo apt install libopus0 opus-tools libopus-dev libsodium-dev ffmpeg tmux -y
elif [ "$VER" = "16.10" ]; then
echo ""
echo "Preparing..."
sudo apt-get install software-properties-common apt-transport-https -y
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ yakkety main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
echo "Installing Git..."
sudo apt install git -y
echo "Installing .NET Core..."
sudo apt install dotnet-dev-1.0.0-preview2.1-003177 -y
echo "Installing prerequisites..."
sudo apt install libopus0 opus-tools libopus-dev libsodium-dev ffmpeg tmux -y
elif [ "$VER" = "17.04" ]; then
echo ""
echo "Preparing..."
sudo apt-get install software-properties-common apt-transport-https -y
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ yakkety main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
echo "Installing Git..."
sudo apt install git -y
echo "Installing .NET Core..."
sudo apt install dotnet-dev-1.0.0-preview2.1-003177 -y
echo "Installing prerequisites..."
sudo apt install libopus0 opus-tools libopus-dev libsodium-dev ffmpeg tmux -y
fi
elif [ "$OS" = "Debian" ]; then
if [ "$SVER" = "8" ]; then
echo ""
echo "Adding .NET to PATH..."
apt-get update
apt-get upgrade -y
apt-get install sudo -y
sudo apt-get install software-properties-common apt-transport-https -y
sudo apt-get install curl libunwind8 gettext -y
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835021
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
echo "Installing prerequisites..."
echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/debian-backports.list
sudo apt-get update && sudo apt install ffmpeg -y
sudo apt-get install libopus0 opus-tools libopus-dev libsodium-dev -y
sudo apt-get install git -y
sudo apt-get install tmux -y
else
echo -e "Your OS $OS $VER $ARCH probably can run Microsoft .NET Core. \nContact NadekoBot's support on Discord with screenshot."
rm nadekoautoinstaller.sh
exit 1
fi
elif [ "$OS" = "CentOS" ]; then
if [ "$VER" = "7" ]; then
echo ""
echo "Preparing..."
yum --obsoletes --exclude=kernel* update -y
yum install sudo -y
sudo yum install libunwind libicu -y
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835019
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
yum -y install http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm epel-release
sudo yum install git opus opus-devel ffempeg tmux -y
else
echo -e "Your OS $OS $VER $ARCH probably can run Microsoft .NET Core. \nContact NadekoBot's support on Discord with screenshot."
rm nadekoautoinstaller.sh
exit 1
fi
elif [ "$OS" = "ArchLinux" ]; then
echo ""
echo "Arch support by PetNoire =^-^="
echo "Preparing..."
sudo pacman -Sy --noconfirm dotnet-runtime dotnet-sdk ffmpeg libsodium git opus redis python tmux wget
sudo wget -nv -N https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
sudo systemctl enable redis
fi
echo
echo "NadekoBot Prerequisites Installation completed..."
sleep 2
rm nadekoautoinstaller.sh
exit 0