Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logic to move files into root dir (#62) #63

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
18 changes: 17 additions & 1 deletion launch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
import re
import shutil
import subprocess

from pathlib import Path
from string import Template

import local
Expand All @@ -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"

Expand All @@ -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"]])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flake8, line was too long

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"]])
Expand All @@ -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 = []
Expand Down