This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
128 lines (102 loc) · 2.93 KB
/
setup.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
#!/bin/sh
## This script automatically sets everything up for you
## to be run upon cloning the repo
# make everything runable
echo "marking scripts as runable..."
chmod +x *.sh
echo "setting up configuration directory..."
mkdir "$HOME/.corki" # bot config directory
mkdir "$HOME/.corki/users" # user directories
mkdir "$HOME/.corki/servers" # server directories
# discord key
if [ ! -f $HOME/.corki/disc_key ]; then
# get bot token
printf "Enter your Discord token: "
read DISCORD_TOKEN
# put token into config dir
printf "inserting token into ur ~/.corki/disc_key... "
echo $DISCORD_TOKEN > $HOME/.corki/disc_key
echo "done"
fi
# riot api key
if [ ! -f $HOME/.corki/riot_key ]; then
# get token
printf "Enter Riot API token: "
read RIOT_TOKEN
# put in file
printf "inserting token into ~/.corki/riot_key... "
echo $RIOT_TOKEN > $HOME/.corki/riot_key
echo "done"
fi
# champion.gg api key
if [ ! -f $HOME/.corki/champgg_key ]; then
# get token
printf "Enter champion.gg API token: "
read CHAMPGG_TOKEN
# put in file
printf "inserting token into ~/.corki/champgg_key... "
echo $CHAMPGG_TOKEN > $HOME/.corki/champgg_key
echo "done"
fi
# discord oauth2 client id
if [ ! -f $HOME/.corki/client_id ]; then
# get token
printf "Enter client id: "
read CLIENT_ID
# put in file
printf "inserting client id into ~/.corki/client_id... "
echo $CLIENT_ID > $HOME/.corki/client_id
echo "done"
fi
# discord oauth2 client secret
if [ ! -f $HOME/.corki/client_secret ]; then
# get token
printf "Enter client secret: "
read CLIENT_SECRET
# put in file
printf "inserting client id into ~/.corki/client_secret... "
echo $CLIENT_SECRET > $HOME/.corki/client_secret
echo "done"
fi
# note: reddit oauth2 id is hard-coded in ./web/pages/user.js
# reddit oauth2 secret
if [ ! -f $HOME/.corki/reddit_secret ]; then
# get token
printf "Enter reddit secret: "
read REDDIT_SECRET
# put in file
printf "inserting client id into ~/.corki/reddit_secret... "
echo $REDDIT_SECRET > $HOME/.corki/reddit_secret
echo "done"
fi
# discord bots list api key
if [ ! -f $HOME/.corki/dbl_api_key ]; then
printf "Enter Discord Bots List API key: "
read DBL_API_KEY
printf "inserting key into ~/.corki/dbl_api_key... "
echo $DBL_API_KEY > $HOME/.corki/dbl_api_key
echo "done"
fi
# required commands
if ! [ -x "$(command -v convert)" ]; then
echo "Error: imagemagick not installed"
exit 1
fi
if ! [ -x "$(command -v forever)" ]; then
echo "Error: forever not installed"
echo "run \"sudo npm install -g forever\""
exit 1
fi
# compile lol mastery log tool
printf "Compiling native components... "
# g++ lol/mastery_log_native/*.cpp -O3 -g -Wall -Wextra -o "$HOME/.corki/lol_mastery_log_tool"
echo "done"
# Initialize mastery cache
if [ ! -f $HOME/.corki/lol_mastery_cache.json ]; then
printf "creating mastery cache..."
echo "{}" > $HOME/.corki/lol_mastery_cache.json
echo "done"
fi
# install dependencies
echo "installing dependencies... "
npm install