forked from miraai/NadekoBot-BashScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nadeko_installer_latest.sh
84 lines (73 loc) · 2.11 KB
/
nadeko_installer_latest.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
#!/bin/sh
echo ""
echo "NadekoBot Installer started."
if hash git 1>/dev/null 2>&1
then
echo ""
echo "Git Installed."
else
echo ""
echo "Git is not installed. Please install Git."
exit 1
fi
if hash dotnet 1>/dev/null 2>&1
then
echo ""
echo "Dotnet installed."
else
echo ""
echo "Dotnet is not installed. Please install dotnet."
exit 1
fi
root=$(pwd)
tempdir=NadekoInstall_Temp
rm -r "$tempdir" 1>/dev/null 2>&1
mkdir "$tempdir"
cd "$tempdir"
echo ""
echo "Downloading NadekoBot, please wait."
git clone -b dev --recursive --depth 1 https://gitlab.com/Kwoth/nadekobot.git
echo ""
echo "NadekoBot downloaded."
echo ""
echo "Downloading Nadeko dependencies"
cd $root/$tempdir/NadekoBot/Discord.Net/src/Discord.Net.Core/
dotnet restore 1>/dev/null 2>&1
cd $root/$tempdir/NadekoBot/Discord.Net/src/Discord.Net.Rest/
dotnet restore 1>/dev/null 2>&1
cd $root/$tempdir/NadekoBot/Discord.Net/src/Discord.Net.WebSocket/
dotnet restore 1>/dev/null 2>&1
cd $root/$tempdir/NadekoBot/Discord.Net/src/Discord.Net.Commands/
dotnet restore 1>/dev/null 2>&1
cd $root/$tempdir/NadekoBot/src/NadekoBot/
dotnet restore 1>/dev/null 2>&1
echo ""
echo "Download done"
echo ""
echo "Building NadekoBot"
cd $root/$tempdir/NadekoBot/src/NadekoBot/
dotnet build --configuration Release 1>/dev/null 2>&1
echo ""
echo "Building done. Moving Nadeko"
cd "$root"
if [ ! -d NadekoBot ]
then
mv "$tempdir"/NadekoBot NadekoBot
else
rm -rf NadekoBot_old 1>/dev/null 2>&1
mv -fT NadekoBot NadekoBot_old 1>/dev/null 2>&1
mv $tempdir/NadekoBot NadekoBot
cp -f $root/NadekoBot_old/src/NadekoBot/credentials.json $root/NadekoBot/src/NadekoBot/credentials.json 1>/dev/null 2>&1
echo ""
echo "credentials.json copied to the new version"
cp -RT $root/NadekoBot_old/src/NadekoBot/bin/ $root/NadekoBot/src/NadekoBot/bin/ 1>/dev/null 2>&1
echo ""
echo "Database copied to the new version"
cp -RT $root/NadekoBot_old/src/NadekoBot/data/ $root/NadekoBot/src/NadekoBot/data/ 1>/dev/null 2>&1
echo ""
echo "Other data copied to the new version"
fi
rm -r "$tempdir"
echo ""
echo "Installation Complete."
exit 0