diff --git a/README.md b/README.md index da8893b..5e6ca6a 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Profiles are saved in `/arma3/configs/profiles` | `-v /arma3/configs` | Folder containing config files | | `-v /arma3/mods` | Mods that will be loaded by clients | | `-v /arma3/servermods` | Mods that will only be loaded by the server | +| `-v /arma3/move_to_root` | Will move any files into the Arma 3 server root directory, for example .dll files | | `-e PORT` | Port used by the server, (uses PORT to PORT+3) | 2302 | | `-e ARMA_BINARY` | Arma 3 server binary to use, `./arma3server_x64` for x64 | `./arma3server` | | `-e ARMA_CONFIG` | Config file to load from `/arma3/configs` | `main.cfg` | diff --git a/launch.py b/launch.py index 3ce22e5..c34b618 100644 --- a/launch.py +++ b/launch.py @@ -1,6 +1,9 @@ import os import re +import shutil import subprocess + +from pathlib import Path from string import Template import local @@ -15,6 +18,7 @@ def env_defined(key): return key in os.environ and len(os.environ[key]) > 0 +BASE_DIR = Path(os.getcwd()).resolve() CONFIG_FILE = os.environ["ARMA_CONFIG"] KEYS = "/arma3/keys" @@ -28,7 +32,8 @@ def env_defined(key): steamcmd = ["/steamcmd/steamcmd.sh"] steamcmd.extend(["+force_install_dir", "/arma3"]) - steamcmd.extend(["+login", os.environ["STEAM_USER"], os.environ["STEAM_PASSWORD"]]) + steamcmd.extend(["+login", os.environ["STEAM_USER"], + os.environ["STEAM_PASSWORD"]]) steamcmd.extend(["+app_update", "233780"]) if env_defined("STEAM_BRANCH"): steamcmd.extend(["-beta", os.environ["STEAM_BRANCH"]]) @@ -37,6 +42,17 @@ def env_defined(key): steamcmd.extend(["validate", "+quit"]) subprocess.call(steamcmd) + +# move any FILES to root dir like .dll +if os.path.exists(BASE_DIR / "move_to_root"): + for file in os.listdir(BASE_DIR / "move_to_root"): + # Check if the path is a directory + if os.path.isdir(BASE_DIR / "move_to_root" / file): + print('f{file} is a directory, create a volume link instead') + else: + # Copy the file and overwrite if it already exists + shutil.copy2(BASE_DIR / "move_to_root" / file, BASE_DIR / file) + # Mods mods = []