Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.36 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import os
  3. import os.path
  4.  
  5. steam_cmd = "/home/steam/arma3/steam/steamcmd.sh"
  6. steam_cmd_params = ""
  7. steam_user = ""
  8. steam_pass = ""
  9.  
  10. a3_server_id = "233780"
  11. a3_server_dir = "/home/steam/arma3/install"
  12. a3_workshop_id = "107410"
  13.  
  14. a3_workshop_dir = "/home/steam/arma3/steam/steamapps/workshop/content/{}".format(a3_workshop_id)
  15. a3_mods_dir = "/home/steam/arma3/mods"
  16.  
  17. mods = {
  18.     "@cba_a3":              "450814997",
  19. #"@ace3":               "463939057",
  20. #"@alive":              "620260972",
  21.     "@cup_terrains_core":   "583496184",
  22.     "@cup_terrains_maps":   "583544987",
  23. #"@cup_weapons":        "497660133",
  24. #"@cup_units":          "497661914",
  25. #"@cup_vehicles":       "541888371",
  26. #"@ifa3lite":           "660460283",
  27. #"@bloodlust":          "667953829",
  28. #"@us_military_mod_a3": "579942493",
  29. #"@project_opfor":      "735566597",
  30. #"@beketov_a3":         "743968516",
  31.     "@rhsafrf":             "843425103",
  32.     "@rhsusaf":             "843577117",
  33.     "@rhsgref":             "843593391",
  34.     "@rhssaf":              "843632231",
  35.     "@xla_fixedarsenal":    "437407341"
  36. }
  37.  
  38. steam_cmd_params += " +login {} {}".format(steam_user, steam_pass)
  39. steam_cmd_params += " +force_install_dir {}".format(a3_server_dir)
  40. steam_cmd_params += " +app_update {} validate".format(a3_server_id)
  41.  
  42. for key, value in mods.items():
  43.     steam_cmd_params += " +workshop_download_item {} {} validate".format(
  44.             a3_workshop_id,
  45.             value
  46.             )
  47.  
  48.     steam_cmd_params += " +quit"
  49.     os.system("{} {}".format(steam_cmd, steam_cmd_params))
  50.     print("")
  51.     print("=========")
  52.     print("Converting uppercase files/folders to lowercase...")
  53.     os.system("find {} -depth -exec rename -v 's/(.*)\/([^\/]*)/$1\/\L$2/' {{}} \;".format(a3_workshop_dir))
  54.  
  55.     print("Creating symlinks...")
  56.     for key, value in mods.items():
  57.         link_path = "{}/{}".format(a3_mods_dir, key)
  58.         real_path = "{}/{}".format(a3_workshop_dir, value)
  59.  
  60.         if os.path.isdir(real_path):
  61.             if not os.path.islink(link_path):
  62.                 os.symlink(real_path, link_path)
  63.                 print("Creating symlink '{}'...".format(link_path))
  64.                 else:
  65.                 print("Symlink '{}' already exists! ({})".format(key, link_path))
  66.                 else:
  67.                 print("Mod '{}' does not exist! ({})".format(key, real_path))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement