-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·203 lines (189 loc) · 7.05 KB
/
setup.sh
File metadata and controls
executable file
·203 lines (189 loc) · 7.05 KB
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
#!/bin/bash
# Bot version
VERSION="v1.11.0"
# Change version below to install newer release from GitHub (if exists)
UPDATEVER="v1.11.0"
# Systemd service name - change if you created systemd entry with different name; only name WITHOUT .service extension
SERVICE_NAME="ServerBot"
OPTIONS=(1 "Start Bot"
2 "Start Bot (not venv)"
3 "Download pip3 libraries"
4 "Create Python3 venv in current dir"
5 "Create .env file"
6 "Enter to Python3 venv"
7 "Manually create systemd entry"
8 "Systemd service options"
9 "Other options")
OPTIONS_sysd=(1 "Enable"
2 "Disable"
3 "Start"
4 "Stop"
5 "Status"
6 "Remove"
7 "Return")
OPTIONS_other=(1 "Edit .env"
2 "Install ServerBot from GitHub"
3 "Manual"
4 "Return")
OPTIONS_YN=(1 "Yes"
2 "No")
select=$(dialog --clear \
--backtitle "ServerBot ${VERSION}" \
--title "ServerBot Setup" \
--menu "Select Operation:" \
18 52 8 \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $select in
1)
echo "Starting ServerBot.py ..."
./.venv/bin/python ServerBot.py $*
;;
2)
echo "Starting ServerBot.py..."
python3 ServerBot.py $*
;;
3)
echo "Running installation script..."
Files/setup/setuplib.sh
;;
4)
echo "Running installation script..."
Files/setup/mkvenv.sh
;;
5)
echo "Creating .env file..."
echo "#ServerBot ${VERSION} config file" > .env
echo "TOKEN=''" >> .env
echo "admin_usr = ['']" >> .env
echo "custom_prefix = ''" >> .env
echo "" >> .env
echo "#AI" >> .env
echo "AI_token=''" >> .env
echo "aimodel = 'gemini-2.5-flash'" >> .env
echo "instructions = ['Always answer in users language','Be precise and truthseeking','Do not answer to illegal, harmful, sexual or violent content']" >> .env
echo "" >> .env
echo "#Music" >> .env
echo "JoinLeaveSounds = True" >> .env
echo "ForceMediaDir = False" >> .env
echo "" >> .env
echo "#Command_dscserv" >> .env
echo "dscserv_link = 'https://discord.gg/UMtYGAx5ac'" >> .env
echo "" >> .env
echo "#Service_list" >> .env
echo "service_monitor = False" >> .env
echo "service_list = ','" >> .env
echo "" >> .env
echo "#Command_addbot" >> .env
echo "addstable = 'stable_link'" >> .env
echo "addtesting = 'testing_link'" >> .env
echo "" >> .env
echo "#Modules" >> .env
echo "LoadAllModules = False" >> .env
echo "" >> .env
echo "#ExtendedErrorMessages" >> .env
echo "extendedErrMess = False" >> .env
sleep 1
bash setup.sh
;;
6)
echo "Entering to Python3 virtual environment..."
source .venv/bin/activate
bash setup.sh
;;
7)
echo "Starting systemd_add.py..."
python3 Files/systemd_add.py
;;
8)
select_sysd=$(dialog --clear \
--backtitle "ServerBot ${VERSION}" \
--title "Systemd service options" \
--menu "These operations will work only if the ${SERVICE_NAME}.service exists" \
18 52 8 \
"${OPTIONS_sysd[@]}" \
2>&1 >/dev/tty)
clear
case $select_sysd in
1)
sudo systemctl enable ${SERVICE_NAME}
bash setup.sh
;;
2)
sudo systemctl disable ${SERVICE_NAME}
bash setup.sh
;;
3)
sudo systemctl start ${SERVICE_NAME}
bash setup.sh
;;
4)
sudo systemctl stop ${SERVICE_NAME}
bash setup.sh
;;
5)
sudo systemctl status ${SERVICE_NAME}
bash setup.sh
;;
6)
select_del=$(dialog --clear \
--backtitle "ServerBot ${VERSION}" \
--title "Remove ${SERVICE_NAME}.service" \
--menu "Are you sure? This will disable service and delete entry." \
18 52 8 \
"${OPTIONS_YN[@]}" \
2>&1 >/dev/tty)
clear
case $select_del in
1)
sudo systemctl stop ${SERVICE_NAME}
sudo systemctl disable ${SERVICE_NAME}
sudo rm /etc/systemd/system/${SERVICE_NAME}.service
;;
2)
bash setup.sh
;;
esac
;;
7)
bash setup.sh
;;
esac
;;
9)
select_other=$(dialog --clear \
--backtitle "ServerBot ${VERSION}" \
--title "ServerBot Setup" \
--menu "Select Operation:" \
18 52 8 \
"${OPTIONS_other[@]}" \
2>&1 >/dev/tty)
clear
case $select_other in
1)
nano .env
bash setup.sh
;;
2)
echo "Install ServerBot from Github..."
echo "This option is useful when you want to update Bot or fix/rebuild critical files."
echo "As default, this option will install ServerBot ${UPDATEVER} in a new directory."
echo "You can change it for other release."
echo "Installer uses git command. Make sure you have downloaded it."
read -p "Type anything to continue."
cd ..
git clone -b ${VERSION} https://github.com/kamile320/ServerBot SB_Update
;;
3)
clear
echo "To see manual, open 'manualEN.html' / 'manualPL.html' or visit https://kamile320.github.io/serverbot/manualEN.html"
read -p "Type anything to continue."
bash setup.sh
;;
4)
bash setup.sh
;;
esac
;;
esac