Advertisement
Guest User

Untitled

a guest
Jan 27th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. #!/bin/bash
  2. #command to manually start if you want to close this script (do it in screen)
  3. #xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine RustDedicated.exe -batchmode +rcon.ip 0.0.0.0 +rcon.port "48000" +rcon.password killer +server.hostname "-LINUX RUST-US-Pro Admins-NO WIPE-NEWBS WELCOM-" +server.port "28015" +server.identity "nfo_rust_server1" +server.maxplayers "2000"
  4. #####################################################################################
  5. # Linux script for Rust server installing. #
  6. # Can also be used to update Rust server and steamcmd. #
  7. # Starts a rust server at the end. #
  8. # #
  9. # If you use a sudoers file please execute this command first to get root access: #
  10. # sudo -s #
  11. # Modded by GregTampa #
  12. # Original by Unknown_Energy #
  13. #####################################################################################
  14.  
  15. #######################################
  16. # define some variables first: #
  17. # please change it to your needs! <-- #
  18. #######################################
  19.  
  20. #directory where everything will be saved
  21. data_directory="/home/robert"
  22.  
  23. #steamname and steamid are need for setting an owner of rust server
  24. owner_name="GregTampa"
  25. owner_steamid="76561197963365871"
  26. owner_name2="osteth"
  27. owner_steamid2="76561198035643024"
  28.  
  29. #some setting for rust server
  30. server_hostname="Jigabot"
  31. server_port=28015
  32. server_identity="nfo_rust_server1"
  33. server_maxplayers=1000
  34. rcon.port=48010
  35. rcon.password="password123"
  36.  
  37. #note I haven't got oxide to work within wine yet
  38.  
  39. #login data for forum of mod oxide:
  40. oxide_login="GregTampa"
  41. oxide_password="mysuperpassword"
  42. #set version of oxide to download
  43. oxide_version=5369
  44.  
  45. #set version of some plugins fpr oxide
  46. oxide_give_version=3813
  47. oxide_teleportation_version=3711
  48. oxide_kits_version=3811
  49. oxide_removertool_version=3837
  50. oxide_godmode_version=3192
  51. oxide_time_version=3819
  52. oxide_playerlist_version=3819
  53. oxide_helptext_version=3367
  54. oxide_gatherrate_version=3721
  55. oxide_craftingrate_version=3820
  56. oxide_airdropsettings_version=3846
  57. oxide_autobroadcast_version=2797
  58. oxide_airdrop_controller=5066
  59. #####################################################################
  60. # first install dialog and show some dialogs with questions: #
  61. #####################################################################
  62.  
  63. apt-get install dialog
  64.  
  65. dialog --backtitle Question --title "Rust-Server" --yesno "Do you want to install/update wine and some libs?" 15 60
  66. update_wine=${?}
  67.  
  68. dialog --backtitle Question --title "Rust-Server" --yesno "Do you want to install/update SteamCMD?" 15 60
  69. update_steamcmd=${?}
  70.  
  71. dialog --backtitle Question --title "Rust-Server" --yesno "Do you want to install/update Rust-Server?" 15 60
  72. update_rust=${?}
  73.  
  74. dialog --backtitle Question --title "Rust-Server" --yesno "Do you want to install/update Oxide mod and its plugins? SAY NO FOR NOW" 15 60
  75. update_oxide=${?}
  76.  
  77. dialog --backtitle Question --title "Rust-Server" --yesno "Do you want to set serverowner?" 15 60
  78. set_owner=${?}
  79.  
  80. dialog --backtitle Question --title "Rust-Server" --yesno "Do you want start the server?" 15 60
  81. start_server=${?}
  82.  
  83. #####################################################################
  84. # installs wine, other needed libs and creats "steam" user: #
  85. #####################################################################
  86.  
  87. if [ "$update_wine" -eq "0" ]
  88. then
  89. #adds the wine repo
  90. add-apt-repository -y ppa:ubuntu-wine/ppa
  91. #makes a update
  92. apt-get -y update
  93. #installs the lib needed for steamcmd + xvfb for window mode of rust + wine
  94. apt-get install -y lib32gcc1 libc6-amd64 xvfb wine1.7
  95. #creates a new Linux user called steam
  96. useradd -m steam
  97. fi
  98.  
  99. #####################################################################
  100. # updates steamcmd: #
  101. #####################################################################
  102.  
  103. if [ "$update_steamcmd" -eq "0" ]
  104. then
  105. #first makes directory called steamcmd/ and then downloads and unpacks steamcmd.
  106. mkdir $data_directory/steamcmd
  107. cd $data_directory/steamcmd
  108. wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
  109. tar -xvzf steamcmd_linux.tar.gz
  110. rm steamcmd_linux.tar.gz
  111. fi
  112.  
  113. #####################################################################
  114. # updates rust server: #
  115. #####################################################################
  116.  
  117. if [ "$update_rust" -eq "0" ]
  118. then
  119. cd $data_directory/steamcmd
  120. #after that steam.sh is executed with some commands: Download windows rust server, login anonymous ...
  121. ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login anonymous +force_install_dir $data_directory/rust +app_update 258550 -beta experimental validate +quit
  122. fi
  123.  
  124. #####################################################################
  125. # updates mod essentials: #
  126. #####################################################################
  127.  
  128. #wget http://rustessentials.com/versions/1.0.0/RustEssentialsRedux.zip
  129. #unzip -o RustEssentialsRedux.zip -d ~/Steam/steamapps/common/rust_dedicated/
  130. #rm RustEssentialsRedux.zip
  131.  
  132. #####################################################################
  133. # updates mod oxide and plugins: #
  134. #####################################################################
  135.  
  136. if [ "$update_oxide" -eq "0" ]
  137. then
  138. #enters server directory
  139. cd $data_directory/rust
  140.  
  141. #Install mod oxide for rust
  142. postdata="login="$oxide_login"&password="$oxide_password
  143. wget --keep-session-cookies --save-cookies=cookies.txt --post-data=$postdata http://oxidemod.org/login/login
  144. wget --load-cookies cookies.txt -p http://oxidemod.org/downloads/oxide-for-rust-experimental.714/download?version=$oxide_version -O Oxide-Rust.zip
  145. unzip -o Oxide-Rust.zip
  146.  
  147. #Install plugins for oxide
  148. mkdir $data_directory/rust/server/$server_identity/oxide/plugins/ -p
  149.  
  150. #remove cookies for oxide forum site and remove zipped oxide rust
  151. rm Oxide-Rust.zip
  152. rm cookies.txt
  153. fi
  154.  
  155. #####################################################################
  156. # sets serverowner: #
  157. #####################################################################
  158.  
  159. if [ "$set_owner" -eq "0" ]
  160. then
  161. #Creates users.cfg and adds a User as owner of the server, so that this user can execute console commands with (F1 Menu).
  162. mkdir $data_directory/rust/server/$server_identity/cfg/ -p
  163. touch $data_directory/rust/server/$server_identity/cfg/users.cfg
  164. echo "ownerid $owner_steamid $owner_name" > $data_directory/rust/server/$server_identity/cfg/users.cfg
  165. echo "ownerid $owner_steamid2 $owner_name2" > $data_directory/rust/server/$server_identity/cfg/users.cfg
  166. fi
  167.  
  168. #####################################################################
  169. # starts server: #
  170. #####################################################################
  171.  
  172. if [ "$start_server" -eq "0" ]
  173. then
  174. chmod -R 777 /home/steam
  175. wineboot --update
  176. #first makes sure user "steam" has all rights
  177. chown steam $data_directory/ -R
  178. #runs rust.exe in wine
  179. su - steam -c "cd $data_directory/rust;xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' WINEARCH=win64 WINEPREFIX=~/.wine64 wine RustDedicated.exe -batchmode +rcon.ip 0.0.0.0 +rcon.port $rcon.port +rcon.password $rcon.password +server.hostname $server_hostname +server.port $server_port +server.identity $server_identity +server.maxplayers $server_maxplayers"
  180. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement