yaml_edit +
This commit is contained in:
parent
c3f9f68e64
commit
47546c48e7
@ -6,9 +6,5 @@ QueryPort: 27015
|
|||||||
ServerPassword:
|
ServerPassword:
|
||||||
MaxPlayers: 70
|
MaxPlayers: 70
|
||||||
ModsId:
|
ModsId:
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
listen: True
|
listen: True
|
||||||
Cluster: False
|
Cluster: False
|
58
dodo.py
58
dodo.py
@ -1,8 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
#map_server = "TheIsland"
|
from pathlib import Path
|
||||||
#dir_server = "~/ARK_Servers/"
|
home_Dir = Path.home()
|
||||||
|
map_server = "TheIsland"
|
||||||
|
dir_server = "~/ARK_Servers/"
|
||||||
#session_name = "Dodo server"
|
#session_name = "Dodo server"
|
||||||
#Port = 7777
|
#Port = 7777
|
||||||
#QueryPort = 27015
|
#QueryPort = 27015
|
||||||
@ -12,14 +14,29 @@ import yaml
|
|||||||
#listen = True
|
#listen = True
|
||||||
#Cluster = False
|
#Cluster = False
|
||||||
|
|
||||||
def read_yaml():
|
#if not os.path.exists("~/.config/dodo/config.yaml"):
|
||||||
with open("config.yaml", "r") as f:
|
#os.system("")
|
||||||
return yaml.safe_load(f)
|
|
||||||
|
|
||||||
if not os.path.exists(dir_server):
|
def yaml_create():
|
||||||
os.mkdir(dir_server)
|
if not os.path.exists(f"{home_Dir}/.config/dodo/"):
|
||||||
|
os.mkdir(f"{home_Dir}/.config/dodo/")
|
||||||
|
if not os.path.exists("config.yaml"):
|
||||||
|
example = open("/usr/share/dodo/config.yaml", "r")
|
||||||
|
f = example.read()
|
||||||
|
else:
|
||||||
|
example = open("config.yaml")
|
||||||
|
f = example.read()
|
||||||
|
config = open(f"{home_Dir}/.config/dodo/config.yaml", "w+")
|
||||||
|
config.write(f)
|
||||||
|
example.close()
|
||||||
|
config.close()
|
||||||
|
|
||||||
def install(map_server):
|
|
||||||
|
|
||||||
|
#if not os.path.exists(dir_server):
|
||||||
|
# os.mkdir(dir_server)
|
||||||
|
|
||||||
|
def yaml_edit():
|
||||||
print("""Укажите требуется ли кластер?
|
print("""Укажите требуется ли кластер?
|
||||||
1. Да
|
1. Да
|
||||||
2. Нет""")
|
2. Нет""")
|
||||||
@ -29,6 +46,15 @@ def install(map_server):
|
|||||||
else:
|
else:
|
||||||
Cluster = False
|
Cluster = False
|
||||||
|
|
||||||
|
print("Укажите название Сервера")
|
||||||
|
session_name = input("")
|
||||||
|
|
||||||
|
print("Укажите порт Сервера <7777>")
|
||||||
|
Port = input("")
|
||||||
|
|
||||||
|
print("Укажите Query-порт Сервера <27015>")
|
||||||
|
QueryPort = input("")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
count_maps = input("Укажите количество карт:\n")
|
count_maps = input("Укажите количество карт:\n")
|
||||||
if count_maps.isdigit:
|
if count_maps.isdigit:
|
||||||
@ -78,20 +104,20 @@ def install(map_server):
|
|||||||
elif count_map == "12":
|
elif count_map == "12":
|
||||||
map_server = "Fjordur"
|
map_server = "Fjordur"
|
||||||
print("Введите цифры")
|
print("Введите цифры")
|
||||||
|
with open("/usr/share/dodo/config.yaml", "rw+") as f:
|
||||||
|
config_Data = yaml.safe_load(f)
|
||||||
|
config_Data[""]
|
||||||
|
def install(map_server):
|
||||||
if not os.path.isdir(dir_server + map_server):
|
if not os.path.isdir(dir_server + map_server):
|
||||||
os.mkdir(dir_server + map_server)
|
os.mkdir(dir_server + map_server)
|
||||||
else:
|
else:
|
||||||
os.system(f"steamcmd +force_install_dir {dir_server + map_server} +login anonymous +app_update 376030 +quit")
|
os.system(f"steamcmd +force_install_dir {dir_server + map_server} +login anonymous +app_update 376030 +quit")
|
||||||
print("Укажите название Сервера")
|
#os.chdir(dir_server + map_server + "/" + "ShooterGame/Binaries/Linux/")
|
||||||
session_name = input("")
|
|
||||||
print("Укажите порт Сервера <7777>")
|
|
||||||
Port = input("")
|
|
||||||
print("Укажите Query-порт Сервера <27015>")
|
|
||||||
QueryPort = input("")
|
|
||||||
install(map_server)
|
|
||||||
os.chdir(dir_server + map_server + "/" + "ShooterGame/Binaries/Linux/")
|
|
||||||
def start():
|
def start():
|
||||||
if Cluster == False:
|
if Cluster == False:
|
||||||
os.system(f"./ShooterGameServer {map_server}?SessionName={session_name}?Port={Port}?QueryPort={QueryPort}?MaxPlayers={MaxPlayers}?GameModIds={ModsId}?listen={listen}")
|
os.system(f"./ShooterGameServer {map_server}?SessionName={session_name}?Port={Port}?QueryPort={QueryPort}?MaxPlayers={MaxPlayers}?GameModIds={ModsId}?listen={listen}")
|
||||||
#os.system("ShooterGameServer")
|
#os.system("ShooterGameServer")
|
||||||
|
yaml_create()
|
||||||
|
yaml_edit()
|
||||||
|
install(map_server)
|
||||||
start()
|
start()
|
Loading…
Reference in New Issue
Block a user