forked from Thornsnake/MCRBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
44 lines (36 loc) · 1.13 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
#!/bin/sh
# Get the base directory and switch into it
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')");
cd "$basedir";
# Install package dependencies
echo "[SETUP] Installing package dependencies ...";
npm install;
# Copy the _config.ts file and rename it to config.ts if it does not exist
if [ ! -f "config.ts" ] ; then
echo "[SETUP] Config file not found! Copying ...";
cp template/_config.ts config.ts;
fi
# Compile source code
echo "[SETUP] Compiling source code ...";
./node_modules/.bin/tsc;
# Check if the bot already has a name
if [ ! -f "bot.name" ]
then
# Name of the bot
echo "";
echo "In case you want to run more than one bot, you need to enter a unique name for each!";
echo "If you are already running a different bot, make sure you give this one another name!";
echo "";
echo -n "How do you want to call this bot: ";
read -r name;
# Make sure the name is valid
while [ ! ${#name} -ge 1 ]
do
echo "Name invalid, try again: ";
read -r name;
done
# Safe the name in a file
echo "[SETUP] Saving name ...";
echo "$name" > bot.name;
fi
echo "[SETUP] Done!";