XaverXor

Rust Server Installer - DEVELOPING

May 16th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 13.83 KB | None | 0 0
  1. title Rust Server installer - by BatchER
  2. cls
  3. @echo off
  4.  
  5.     rem Set Vaiables
  6. echo --------------------------------------------------------------------
  7. echo Change, if desired, your instlling directory.
  8.  
  9. :directory_change1
  10. set /p directory_change=Do you want to change your installing directory from default C:\RustServer\ [y]es / [n]o
  11. if "%directory_change%" == "y" (
  12.     echo The path should look like this: C:\Folder1\Folder2\Folder3\
  13.     set /p directory=Enter directoy path:
  14.     goto directory_change3
  15. ) else (
  16.     goto directory_change2
  17. )
  18. :directory_change2
  19. if "%directory_change%" == "n" (
  20.     set directory=C:\RustServer\
  21.     goto directory_change3
  22. ) else (
  23.     cls
  24.     echo Error - invalid answer
  25.     goto directory_change1
  26. )
  27. :directory_change3
  28. cls
  29.  
  30. echo --------------------------------------------------------------------
  31.  
  32. :mods1
  33. echo Oxide is a programm to install mods in your Rust server. For more information visit: http://oxidemod.org/
  34. set /p mods=Do you want to install Oxide [y]es / [n]o?
  35. if "%mods%" == "y" (
  36.     set install_oxide=y
  37.     goto mods3
  38. ) else (
  39.     goto mods2
  40. )
  41. :mods2
  42. if "%mods%" == "n" (
  43.     set install_oxide=n
  44.     goto mods3
  45. ) else (
  46.     cls
  47.     echo Error - invalid answer
  48.     goto mods1
  49. )
  50. :mods3
  51. cls
  52.  
  53. echo --------------------------------------------------------------------
  54.  
  55. :port_change1
  56. set /p port_change=Do you want to change your server port from default 28015 [y]es / [n]o
  57. if "%port_change%" == "y" (
  58.     set /p port=Enter the new port:
  59.     goto port_change3
  60. ) else (
  61.     goto port_change2
  62. )
  63. :port_change2
  64. if "%port_change%" == "n" (
  65.     set port=28015
  66.     goto port_change3
  67. ) else (
  68.     cls
  69.     echo Error - invalid answer
  70.     goto port_change1
  71. )
  72. :port_change3
  73.  
  74. cls
  75. echo --------------------------------------------------------------------
  76. echo Be sure to check out the "help" directory in your server, to get detailled instructions about connecting and playing with friends
  77. echo Press any key to continue
  78.  
  79. pause
  80.  
  81.     rem Set IP Variable
  82. for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "IPv4"') do set ip=%%b
  83. set ip=%ip:~1%
  84.  
  85.     rem create directorys
  86. if exist %directory% (
  87.     goto directory_after
  88. ) else (
  89.     md %directory%
  90. )
  91. :directory_after
  92.  
  93. md %directory%SteamCMD
  94. md %directory%RustServer
  95. md %directory%RustServer\help
  96.  
  97.     rem Download SteamCMD
  98. :cmd_not_exist
  99. cls
  100. echo --------------------------------------------------------------------
  101. echo %date% %time% attempt to download SteamCMD
  102. timeout 2
  103. bitsadmin /transfer download_SteamCMD /download /priority normal https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip %directory%SteamCMD\steamcmd.zip
  104.  
  105. setlocal
  106. set cmd_file="%directory%SteamCMD\steamcmd.zip"
  107. set cmd_bytesize=755
  108.  
  109. FOR /F "usebackq" %%A IN ('%cmd_file%') DO set size=%%~zA
  110.  
  111. if %size% GTR %cmd_bytesize% (
  112.     goto cmd_exist
  113. ) else (
  114.     del cmd_file
  115.     goto cmd_not_exist
  116. )
  117. :cmd_exist
  118. cls
  119. echo --------------------------------------------------------------------
  120. echo %date% %time% SteamCMD successfully downloaded
  121. timeout 2
  122.  
  123.     rem Unzip SteamCMD
  124. :unzip_not_exist
  125. cls
  126. echo --------------------------------------------------------------------
  127. echo %date% %time% attempt to download unzipper
  128. timeout 2
  129. bitsadmin /transfer download_unzipper /download /priority high http://stahlworks.com/dev/unzip.exe %directory%SteamCMD\unzip.exe
  130.  
  131. setlocal
  132. set unzip_file="%directory%SteamCMD\unzip.exe"
  133. set unzip_bytesize=163
  134.  
  135. FOR /F "usebackq" %%A IN ('%unzip_file%') DO set size=%%~zA
  136.  
  137. if %size% GTR %unzip_bytesize% (
  138.     goto unzip_exist
  139. ) else (
  140.     del %unzip_file%
  141.     goto unzip_not_exist
  142. )
  143. :unzip_exist
  144. cls
  145. echo --------------------------------------------------------------------
  146. echo unzipper successfully downloaded
  147. timeout 2
  148.  
  149. cd %directory%SteamCMD
  150. unzip steamcmd.zip
  151.  
  152.     rem Install SteamCMD
  153. >> %directory%SteamCMD\input.txt echo login anonymous
  154. >> %directory%SteamCMD\input.txt echo force_install_dir %directory%RustServer\
  155. >> %directory%SteamCMD\input.txt echo app_update 258550
  156. >> %directory%SteamCMD\input.txt echo quit
  157.  
  158. cls
  159.  
  160. %directory%SteamCMD\steamcmd.exe < input.txt
  161.  
  162. del %directory%SteamCMD\input.txt
  163.  
  164.     rem Writing How to Join
  165. >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  166. >> %directory%RustServer\help\HowToJoin.txt echo Open your console in Rust with pressing "F1" and then press strg+v to pass in the command to connect to your server. It will be copied to your clipboard every time you start your server.
  167. >> %directory%RustServer\help\HowToJoin.txt echo Or type in: client.connect %ip%:%port%
  168. >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  169. >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  170. >> %directory%RustServer\help\HowToJoin.txt echo There are two ways to play with your friends:
  171. >> %directory%RustServer\help\HowToJoin.txt echo 1:     Download and run LogMeIn Hamachi. For that run "install_LogMeInHamchi.bat" in your folder "help" and follow the instructions to install
  172. >> %directory%RustServer\help\HowToJoin.txt echo    now create a network and let your friends join
  173. >> %directory%RustServer\help\HowToJoin.txt echo    go to the "server.bat" file and change the IP-Adress to your Hamachi IPv4 IP
  174. >> %directory%RustServer\help\HowToJoin.txt echo    now your friends can join by typing in "client.connect -HamchiIP-:%port%"
  175. >> %directory%RustServer\help\HowToJoin.txt echo 2:     Open the port given in your "run.bat" in your router with Port-Forwarding (Video-Tutorial: https://www.youtube.com/playlist?list=PLwpd5nRUaDqE-a48Y2WT4N8cYCLXZuodc)
  176. >> %directory%RustServer\help\HowToJoin.txt echo    now your friends can join by searching for your Server in the official/modded servers, depending on if you have installed Oxide, in Rust
  177. >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  178. >> %directory%RustServer\help\HowToJoin.txt echo NOTICE when you change your Server-IP or your Server-Port run the update.bat
  179.  
  180.     rem Write connect.txt
  181. >> %directory%RustServer\connect.txt echo client.connect %ip%:%port%
  182.  
  183.     rem Write run.bat
  184. >> %directory%RustServer\run.bat echo clip < connect.txt
  185. >> %directory%RustServer\run.bat echo RustDedicated.exe -batchmode +server.hostname "MyServer" +server.ip %ip% -server.port %port% +server.maxplayer 2 -logFile server.log +rcon.password "12345" -server.worldsize 4000
  186.  
  187.     rem Wirte update.bat
  188. >> %directory%RustServer\update.bat echo for /f "tokens=6" %%a in (run.bat) do set newip=%%a
  189. >> %directory%RustServer\update.bat echo for /f "tokens=8" %%a in (run.bat) do set newport=%%a
  190. >> %directory%RustServer\update.bat echo del connect.txt
  191. >> %directory%RustServer\update.bat echo >> %directory%RustServer\connect.txt client.connect %newip%:%newport%
  192. >> %directory%RustServer\update.bat echo del %directory%RustServer\help\HowToJoin.txt
  193. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  194. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo Open your console in Rust with pressing "F1" and then press strg+v to pass in the command to connect to your server. It will be copied to your clipboard every time you start your server.
  195. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo Or type in: client.connect %newip%:%newport%
  196. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  197. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  198. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo There are two ways to play with your friends:
  199. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo 1:    Download and run LogMeIn Hamachi. For that run "install_LogMeInHamchi.bat" in your folder "help" and follow the instructions to install
  200. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo   now create a network and let your friends join
  201. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo   go to the "server.bat" file and change the IP-Adress to your Hamachi IPv4 IP
  202. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo   now your friends can join by typing in "client.connect -HamchiIP-:%newport%"
  203. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo 2:    Open the port given in your "run.bat" in your router with Port-Forwarding (Video-Tutorial: https://www.youtube.com/playlist?list=PLwpd5nRUaDqE-a48Y2WT4N8cYCLXZuodc)
  204. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo   now your friends can join by searching for your Server in the official/modded servers, depending on if you have installed Oxide, in Rust
  205. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo --------------------------------------------------------------------
  206. >> %directory%RustServer\update.bat echo >> %directory%RustServer\help\HowToJoin.txt echo NOTICE when you change your Server-IP or your Server-Port run the update.bat
  207.  
  208.     rem Write Install LogMeIn Hamachi
  209. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo :hamachi_not_exist
  210. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo cls
  211. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo echo --------------------------------------------------------------------
  212. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo echo %date% %time% attempt to download Hamachi
  213. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo timeout 2
  214. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo bitsadmin /transfer download_LogMeInHamachi /download /priority normal https://secure.logmein.com/hamachi.msi %directory%RustServer\help\hamachi.msi
  215. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo setlocal
  216. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo set hamachi_file="%directory%RustServer\help\hamachi.msi"
  217. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo set hamachi_bytesize=8784
  218. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo FOR /F "usebackq" %%A IN ('%hamachi_file%') DO set size=%%~zA
  219. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo if %size% GTR %hamachi_bytesize% (
  220. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo    goto hamachi_exist
  221. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo ) else (
  222. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo    del %hamachi_file%
  223. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo    goto hamachi_not_exist
  224. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo )
  225. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo :hamachi_exist
  226. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo cls
  227. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo echo --------------------------------------------------------------------
  228. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo echo %date% %time% Hamachi successfully downloaded
  229. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo timeout 2
  230. >> %directory%RustServer\help\install_LogMeInHamchi.bat echo start %directory%RustServer\help\hamachi.msi
  231.  
  232.     rem Install Oxide?
  233. if "%install_oxide%" == "y" (
  234.     goto installing_oxide
  235. ) else (
  236.     goto end
  237. )
  238.  
  239. :istalling_oxide
  240.  
  241.     rem Download Oxide
  242. md %directory%SteamCMD\temp\
  243.  
  244. :oxide_not_exist
  245. cls
  246. echo --------------------------------------------------------------------
  247. echo %date% %time% attempt to download Oxide
  248. timeout 2
  249. bitsadmin /transfer download_Oxide /download /priority normal https://github.com/OxideMod/Snapshots/raw/master/Oxide-Rust.zip %directory%SteamCMD\temp\Oxide-Rust.zip
  250.  
  251. setlocal
  252. set oxide_file="%directory%SteamCMD\temp\Oxide-Rust.zip"
  253. set oxide_bytesize=11432
  254.  
  255. FOR /F "usebackq" %%A IN ('%oxide_file%') DO set size=%%~zA
  256.  
  257. if %size% GTR %oxide_bytesize% (
  258.     goto oxide_exist
  259. ) else (
  260.     del %oxide_file%
  261.     goto oxide_not_exist
  262. )
  263. :oxide_exist
  264. cls
  265. echo --------------------------------------------------------------------
  266. echo Oxide successfully downloaded
  267. timeout 2
  268.  
  269.     rem Unzip and install oxide
  270. move %directory%SteamCMD\unzip.exe %directory%SteamCMD\temp\unzip.exe
  271. cd %directory%SteamCMD\temp
  272.  
  273. unzip Oxide-Rust.zip
  274.  
  275. del unzip.exe
  276. del Oxide-Rust.zip
  277.  
  278. move /q %directory%SteamCMD\temp\RustDedicated_Data %directory%RustServer\
  279. move /q %directory%SteamCMD\temp\_start-example.bat %directory%RustServer\
  280. move /q %directory%SteamCMD\temp\CSharpCompiler.exe %directory%RustServer\
  281. move /q %directory%SteamCMD\temp\oxide.root.json %directory%RustServer\
  282.  
  283.     rem Write about Oxide
  284. >> %directory%RustServer\help\About_Oxide.txt echo Oxide is a Programm, which allows you to install mods into Rust
  285. >> %directory%RustServer\help\About_Oxide.txt echo For more information visit: http://oxidemod.org/
  286.  
  287.     rem Write how to use Oxide
  288. >> %directory%RustServer\help\How_to_use_Oxide.txt echo Download Mods from the Oxide-Rust forum (http://oxidemod.org/plugins/categories/rust.24/)
  289. >> %directory%RustServer\help\How_to_use_Oxide.txt echo past them into the directory %directory%RustServer\server\my_server_identity\oxide\plugins
  290.  
  291. :end
  292.  
  293.     rem Run Server
  294. >> %directory%RustServer\input.txt echo save
  295. >> %directory%RustServer\input.txt echo quit
  296.  
  297. %directory%RustServer\run.bat < input.txt
  298.  
  299. cls
  300. echo --------------------------------------------------------------------
  301. echo Installation finished!
  302. echo To quit press any key
  303. echo Be sure to don't forget to check out the "help" directory, located in your RustServer file
  304.  
  305. pause
  306.  
  307. del %directory%RustServer\input.txt
Advertisement
Add Comment
Please, Sign In to add comment