Search the Community
Showing results for tags 'bash'.
Found 1 result
-
README.MD # GUESS WHAT! THIS PROJECT IS COMPLETELY UNTESTED! # ArmA1button 1 button (almost) build, deploy ArmA 3 server with mods ## The bullshit - Get docker.io - Create files creds and steamguard with your steam credentials and current steamguard code. - Create file server.cfg as per https://community.bistudio.com/wiki/Arma_3:_Server_Config_File ``` echo "[steamuid] [steampasswd]" > creds echo "[steamguardcode]" > steamguard ``` - When ./build.sh is invoked by _AACREATEARMA.sh > prepfolder.sh, Steam should reject your Steamguard code. - Immediate check your email and update the steamguard file. - Run it from the top again. If you're fast enough it should accept the old code. ## Mods - The modlist and missionlist files are both of the following format ``` [IDNUMBER]=[ARBITRARYNAME] ``` - Mods can be named anything; mission names MUST end with .[mapcode]. - Missions are downloaded in the usual manner. Softlinks are created in .../Arma\ 3\ Server/mpmissions. - Mods are downloaded in the usual manner. - If the addons and keys folders names are unnormalized, they are normalized. - Individual file names in .../addons are normalized. Soft links are created in .../Arma\ 3\ Server/keys and .../Arma\ 3\ Server/mods/lns - The file modline is discharged to .../Arma\ 3\ Server/mods ## Files - _AACREATEARMA.sh: Entrypoint. - build.sh: invokes docker build. Will attempt to build arma-i using maxhougas/steambox-i:db. - cheapinstall.sh installs and links mods and missions. Does the jobs of installmods.sh, installmissions.sh, linkmod.sh, and linkkey.sh. - creds: contains your actual Steam credentials in plaintext. Super-duper secure, never blind or delete this file. Not included. - dexec.sh: invokes docker exec. Can only take a single argument. - dockerfile.db: used when invoking docker build (build.sh). Will contain plaintext credentials. Discharged and deleted after use by prepfolder.sh - installmod.sh: invokes docker exec > steamcmd.sh. Useful for mods that DLs that time out. Does not link anything. - linkkey.sh: invoked by cheapinstall.sh. Creates softlinks. - linkmod.sh: invoked by cheapinstall.sh. Creates softlinks. - missionlist: contains idnumbers and mission names. Mission names *MUST* end with .[mapcode]. - modlist: contains idnumbers and modnames. Mod names are arbitrary, but this system assumes names contain only [0-9A-Za-z._-]*. - patharma: contains the full path to .../Arma\ 3\ Server, it is rendered as /Arma 3 Server though, be careful with that. - pathmod: contains the full path to .../107410. - prepfolder.sh: poorly named, creates .../mods and .../mods/lns; copies runarma.sh and server.cfg to .../mods; discharges dockerfile.db. - README.MD: this. - restart.sh: invokes docker stop and docker start. - run.sh: invokes docker run. Will attempt to run arma-s. Incoming ports are specified here. Bind mounts are specified here. - server.cfg: config file. Not included. - start.sh: invokes docker stop. - steamguard: contains your steamguard code. - steaminst: a steam CMD script file. Will contain plaintext credentials. Dischaged and deleted after use by cheapinstall.sh. Not included. - stop.sh: invokes docker start. ### Depricated - installmods.sh: invokes docker exec > steamcmd.sh to download mods. Creates appropriate softlinks and discharges the modline file. - installmissions.sh: invokes docker exec > steamcmd.sh to download missions. Creates softlinks. ~~~ _AACREATEARMA.sh #!/bin/bash ./prepfolder.sh ./run.sh ./cheapinstall.sh ./restart.sh ~~~ build.sh #!/bin/bash docker pull maxhougas/steambox-i:db docker build -t arma-i -f dockerfile.db . ~~~ cheapinstall.sh #!/bin/bash arma=$(cat patharma) mods=$(cat pathmod) echo "set_steam_guard_code $(cat steamguard)" > mods/steaminst echo "login $(cat creds)" > mods/steaminst echo "$(cat modlist)" >> mods/steaminst echo "$(cat missionlist)" >> mods/steaminst sed -i 's:^:workshop_download_item 107410 :g' mods/steaminst sed -i 's:^workshop_download_item 107410 set:set:g' mods/steaminst sed -i 's:^workshop_download_item 107410 login:login:g' mods/steaminst sed -i 's:=[A-Za-z0-9._-]*::g' mods/steaminst echo "quit" >> mods/steaminst docker exec -ti arma-s /steam/steamcmd.sh +runscript "$arma/mods/steaminst" #obliterate credentials rm mods/steaminst #Start modline echo -n \" > mods/modline #iterate modlist for line in $(cat modlist) do id=$(echo $line | sed "s:=[A-Za-z0-9._-]*::g") mname=$(echo $line | sed "s:[0-9]*=::g") ./linkmod.sh $id $mname ./linkkey.sh $id #Build modline echo -n "mods/lns/$mname;" >> mods/modline done #Finish modline sed -i "s:;$:\":g" mods/modline #iterate missionlist for line in $(cat missionlist) do id=$(echo $line | sed "s:=[A-Za-z0-9._-]*::g") mname=$(echo $line | sed "s:[0-9]*=::g") file=$(docker exec -t arma-s ls -1 $mods/$id | grep -io "[a-zA-Z0-9._-]*") docker exec -t arma-s ln -sfT $mods/$id/$file "$arma/mpmissions/$mname.pbo" done ~~~ linkkey.sh #!/bin/bash #$1 = id mod=$(cat pathmod) arma=$(cat patharma) #normalize keys folder if [ -n "$(docker exec -t arma-s ls $mod/$1 | grep -o 'Keys')" ]; then docker exec -t arma-s mv $mod/$1/Keys $mod/$1/keys fi if [ -n "$(docker exec -t arma-s ls $mod/$1 | grep -io 'keys')" ]; then for kname in $(docker exec -t arma-s ls $mod/$1/keys | grep -io "[A-Z0-9a-z._-]*.bikey") do #normalize key names nkname=$(echo $kname | tr [A-Z] [a-z]) if [ "$kname" != "$nkname" ]; then docker exec -t arma-s mv $mod/$1/keys/$kname $mod/$1/keys/$nkname fi docker exec -t arma-s ln -sT $mod/$1/keys/$nkname "$arma/keys/$nkname" done fi ~~~ linkmod.sh #!/bin/bash #$1 = id #$2 = name mod=$(cat pathmod) arma=$(cat patharma) #normalize addons folder if [ -n "$(docker exec -t arma-s ls $mod/$1 | grep -o 'Addons')" ]; then docker exec -t arma-s mv $mod/$1/Addons $mod/$1/addons fi #normalize pbo names for pname in $(docker exec -t arma-s ls $mod/$1/addons | grep -io "[A-Z0-9a-z._-]*") do npname=$(echo $pname | tr [A-Z] [a-z]) if [ "$pname" != "$npname" ]; then docker exec -t arma-s mv $mod/$1/addons/$pname $mod/$1/addons/$npname fi done #link docker exec -t arma-s ln -sT $mod/$1 "$arma/mods/lns/$2" ~~~ missionlist 2897579624=lish.vr ~~~ modlist 1388025252=mxretexture ~~~ patharma /root/Steam/steamapps/common/Arma 3 Server ~~~ pathmod /root/Steam/steamapps/workshop/content/107410 ~~~ prepfolder.sh #!/bin/bash #Prepare folder structure mkdir mods mkdir mods/lns cp server.cfg mods cp runarma.sh mods #Pull base image docker pull maxhougas/steambox-i:db #Discharge dockerfile echo "FROM maxhougas/steambox-i:db" > dockerfile.db echo "RUN ./steamcmd.sh +set_steam_guard_code $(cat steamguard) +login $(cat creds) +app_update 233780 +quit" >> dockerfile.db echo "WORKDIR /root/Steam/steamapps/common/Arma\\ 3\\ Server" >> dockerfile.db echo "CMD ./mods/runarma.sh" >> dockerfile.db #build image ./build.sh #Obliterate credentials rm dockerfile.db ~~~ run.sh #!/bin/bash docker run -dp 2302-2306:2302-2306/udp -v $(pwd)/save:/root/.local/share/Arma\ 3\ -\ Other\ Profiles/Player -v $(pwd)/107410:$(cat pathmod) -v $(pwd)/mods:/root/Steam/steamapps/common/Arma\ 3\ Server/mods --name arma-s arma-i ~~~ runarma.sh #!/bin/bash cd /root/Steam/steamapps/common/Arma\ 3\ Server ./arma3server_x64 -config=mods/server.cfg -mod=$(cat mods/modline) > mods/arma.log ~~~ start.sh #!/bin/bash docker start arma-s ~~~ stop.sh #!/bin/bash docker stop arma-s ~~~ Github link = https COLON SLASH SLASH github DOT com SLASH maxhougas SLASH arma1button Put a decent chunk of work into this; hope it helps someone. I got notifications for this one turned on, so holler any questions, comments, complaints, gripes, or bitches.