Prep: also rsync config_player.xml to server
This commit is contained in:
47
prep
47
prep
@@ -11,6 +11,8 @@ AUTOGEN = os.path.join(BASE, "scripts", "autogen_config.py")
|
|||||||
LOCALMODS_DIR = os.path.join(BASE, "LocalMods")
|
LOCALMODS_DIR = os.path.join(BASE, "LocalMods")
|
||||||
|
|
||||||
RSYNC_DEST = "root@barotrauma:/opt/barotrauma/LocalMods/"
|
RSYNC_DEST = "root@barotrauma:/opt/barotrauma/LocalMods/"
|
||||||
|
CONFIG_PATH = os.path.join(BASE, "config_player.xml")
|
||||||
|
RSYNC_SSH = "ssh -p 22"
|
||||||
|
|
||||||
|
|
||||||
def log_ok(msg):
|
def log_ok(msg):
|
||||||
@@ -27,31 +29,46 @@ def main():
|
|||||||
msg = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else "Update LocalMods"
|
msg = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else "Update LocalMods"
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print("╔═══════════════════════════════════════╗")
|
print("╔══════════════════════════════════════════╗")
|
||||||
print("║ Prep: mods → rsync → config → commit ║")
|
print("║ Prep: mods → config → rsync → commit ║")
|
||||||
print("╚═══════════════════════════════════════╝")
|
print("╚══════════════════════════════════════════╝")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
log_info("Step 1/4: Copy mods from workshop...")
|
log_info("Step 1/5: Copy mods from workshop...")
|
||||||
subprocess.run([sys.executable, PREPARE_LOCAL], check=True)
|
subprocess.run([sys.executable, PREPARE_LOCAL], check=True)
|
||||||
log_ok("LocalMods ready")
|
log_ok("LocalMods ready")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
log_info("Step 2/4: Rsyncing LocalMods/ to server...")
|
log_info("Step 2/5: Generating config_player.xml...")
|
||||||
subprocess.run([
|
|
||||||
"rsync", "-avz", "--delete",
|
|
||||||
"-e", "ssh -p 22",
|
|
||||||
LOCALMODS_DIR + "/", RSYNC_DEST
|
|
||||||
], check=True)
|
|
||||||
log_ok("LocalMods synced to homelabvm")
|
|
||||||
print()
|
|
||||||
|
|
||||||
log_info("Step 3/4: Generating config_player.xml...")
|
|
||||||
subprocess.run([sys.executable, AUTOGEN], check=True)
|
subprocess.run([sys.executable, AUTOGEN], check=True)
|
||||||
log_ok("config_player.xml generated")
|
log_ok("config_player.xml generated")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
log_ok("Done.")
|
log_info("Step 3/5: Rsyncing LocalMods/ to server...")
|
||||||
|
subprocess.run([
|
||||||
|
"rsync", "-avz", "--delete",
|
||||||
|
"-e", RSYNC_SSH,
|
||||||
|
LOCALMODS_DIR + "/", RSYNC_DEST
|
||||||
|
], check=True)
|
||||||
|
log_ok("LocalMods synced")
|
||||||
|
print()
|
||||||
|
|
||||||
|
log_info("Step 4/5: Rsyncing config_player.xml to server...")
|
||||||
|
subprocess.run([
|
||||||
|
"rsync", "-avz",
|
||||||
|
"-e", RSYNC_SSH,
|
||||||
|
CONFIG_PATH, "root@barotrauma:/opt/barotrauma/config_player.xml"
|
||||||
|
], check=True)
|
||||||
|
log_ok("config_player.xml synced")
|
||||||
|
print()
|
||||||
|
|
||||||
|
log_info("Step 5/5: Committing...")
|
||||||
|
subprocess.run(["git", "add", "-A"], cwd=BASE, check=True)
|
||||||
|
subprocess.run(["git", "commit", "-m", msg], cwd=BASE, check=True)
|
||||||
|
log_ok(f"Committed: {msg}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
log_ok("Done. Push manually when ready.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user