-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·40 lines (29 loc) · 899 Bytes
/
install
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
#!/usr/bin/python3
# Install and run the server
import config as c
import os
config = c.load_config()
world_link = config["world_link"]
server_link = config["server-link"]
extract = config["extract"]
# Symlink the other shit
# TODO: add ability to change the install location
os.symlink("backup.py","/usr/local/bin/backup")
os.symlink("destroy.py", "/usr/local/bin/destroy")
# Replace with the config
server_root = config["root_directory"]
server_name = "server.%s"%("zip" if extract else "jar")
print(server_name)
try:
os.mkdir(server_root)
except FileExistsError:
pass
os.chdir(server_root)
os.system(f'wget {server_link} -O {server_name}')
if extract:
os.system(f'unzip {server_name}')
if world_link:
os.system(f'wget {world_link} -O world.zip')
os.system(f'unzip world.zip')
os.remove("world.zip")
os.system(f"screen -S server -dm \"{config['start-cmd']}\"")