создание каталогов
This commit is contained in:
parent
177fc53f1d
commit
76903c0360
32
hlna.py
32
hlna.py
@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import threading
|
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
import click
|
import click
|
||||||
import colorama
|
import colorama
|
||||||
@ -15,7 +13,9 @@ dir_server = f"{home_dir}/ARK_Servers/"
|
|||||||
server_dir = dir_server + "ShooterGame/Binaries/Linux/"
|
server_dir = dir_server + "ShooterGame/Binaries/Linux/"
|
||||||
dir_unit = f"{home_dir}/.config/systemd/user/"
|
dir_unit = f"{home_dir}/.config/systemd/user/"
|
||||||
dir_config = f"{home_dir}/.config/hlna/"
|
dir_config = f"{home_dir}/.config/hlna/"
|
||||||
|
dir_logs = f"{dir_config}logs"
|
||||||
dir_maps = f"{dir_config}maps/"
|
dir_maps = f"{dir_config}maps/"
|
||||||
|
dir_deactivated = f"{dir_maps}deactivated/"
|
||||||
|
|
||||||
mods_id = ""
|
mods_id = ""
|
||||||
listen_server = True
|
listen_server = True
|
||||||
@ -26,6 +26,20 @@ def hlna():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def create_dir(directory):
|
||||||
|
"""Проверка и создание директории"""
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
os.mkdir(directory)
|
||||||
|
|
||||||
|
|
||||||
|
create_dir(dir_server)
|
||||||
|
create_dir(dir_unit)
|
||||||
|
create_dir(dir_config)
|
||||||
|
create_dir(dir_logs)
|
||||||
|
create_dir(dir_maps)
|
||||||
|
create_dir(dir_deactivated)
|
||||||
|
|
||||||
|
|
||||||
def find_file(path):
|
def find_file(path):
|
||||||
"""Находим все конфиги в зависимости от пути"""
|
"""Находим все конфиги в зависимости от пути"""
|
||||||
arr = next(os.walk(path), (None, None, []))[2] # [] if no file
|
arr = next(os.walk(path), (None, None, []))[2] # [] if no file
|
||||||
@ -39,7 +53,7 @@ def find_file(path):
|
|||||||
|
|
||||||
|
|
||||||
list_config = find_file(dir_maps)
|
list_config = find_file(dir_maps)
|
||||||
delist_config = find_file(dir_config+"deactivated")
|
delist_config = find_file(dir_deactivated)
|
||||||
|
|
||||||
|
|
||||||
def print_line(text):
|
def print_line(text):
|
||||||
@ -49,12 +63,6 @@ def print_line(text):
|
|||||||
print(colorama.Fore.YELLOW + "-"*30 + colorama.Style.RESET_ALL)
|
print(colorama.Fore.YELLOW + "-"*30 + colorama.Style.RESET_ALL)
|
||||||
|
|
||||||
|
|
||||||
def create_dir(directory):
|
|
||||||
"""Проверка и создание директории"""
|
|
||||||
if not os.path.exists(directory):
|
|
||||||
os.mkdir(directory)
|
|
||||||
|
|
||||||
|
|
||||||
def check_int(number=""):
|
def check_int(number=""):
|
||||||
"""Проверка на ввод числа"""
|
"""Проверка на ввод числа"""
|
||||||
while True:
|
while True:
|
||||||
@ -68,13 +76,9 @@ def check_int(number=""):
|
|||||||
print("Введите число")
|
print("Введите число")
|
||||||
|
|
||||||
|
|
||||||
create_dir(dir_server)
|
|
||||||
create_dir(dir_unit)
|
|
||||||
create_dir(dir_config)
|
|
||||||
create_dir(dir_maps)
|
|
||||||
|
|
||||||
@hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов')
|
@hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов')
|
||||||
def config(list_config=list_config):
|
def config(list_config=list_config):
|
||||||
|
"""Сбор данных для конфига"""
|
||||||
data = {}
|
data = {}
|
||||||
port_s = []
|
port_s = []
|
||||||
rcon_p = []
|
rcon_p = []
|
||||||
|
Loading…
Reference in New Issue
Block a user