Changes in bootstrapper/bootstrap.sh [30:7]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bootstrapper/bootstrap.sh
r30 r7 1 1 #!/bin/bash 2 # Version 1 3 4 if [ `id -u` -ne 0 ]; then 5 echo "This script has to be run as root!" 6 exit 1 7 fi 8 9 2 3 INSTALLOPTIONALDEPS=0 10 4 ADDCRONJOBS=0 11 5 RUNINSTALL=0 12 6 13 DEPENDENCIES="xvfb mono-runtime rsync xmlstarlet" 7 DEPENDENCIES="xvfb mono-runtime rsync libxml2-utils" 8 OPTDEPENDENCIES="sendemail sendxmpp" 14 9 15 10 if [ -n "$(command -v apt-get)" ]; then … … 25 20 fi 26 21 27 if [ $IS64BIT -eq 1]; then22 if [[ $IS64BIT == 1 ]]; then 28 23 DEPENDENCIES="$DEPENDENCIES lib32gcc1 wine:i386" 29 24 else … … 32 27 33 28 showHelp() { 34 echo "Usage: ./bootstrap.sh [-h] [- c] -i"29 echo "Usage: ./bootstrap.sh [-h] [-o] [-c] -i" 35 30 echo "Parameters:" 36 31 echo " -h Print this help screen and exit" 37 #echo " -o Install optional dependencies ($OPTDEPENDENCIES)"32 echo " -o Install optional dependencies ($OPTDEPENDENCIES)" 38 33 echo " -c Add cron jobs for save backups and memory checking" 39 34 echo " -i Required to actually start the installation" … … 46 41 echo "This will install a 7DtD server according to the information" 47 42 echo "given on:" 48 echo " http s://7dtd.illy.bz/"43 echo " http://7daystodie.gamepedia.com/Linux_Server" 49 44 echo 50 45 read -p "Press enter to continue" … … 53 48 54 49 nonDebianWarning() { 55 if [ $ISDEBIAN -eq 0]; then50 if [[ $ISDEBIAN == 0 ]]; then 56 51 echo "NOTE: It seems like this system is not based on Debian." 57 52 echo "Although installation of the scripts and SteamCMD/7dtd" 58 53 echo "will work the installed management scripts will probably" 59 echo "fail because of missing dependencies. Make sure you check" 60 echo "the website regarding the prerequisites" 61 echo "(https://7dtd.illy.bz)." 54 echo "*NOT* work out of the box and installation of dependencies" 55 echo "will fail too." 62 56 echo "Do you want to continue anyway?" 63 57 select yn in "Yes" "No"; do … … 78 72 installAptDeps() { 79 73 echo -e "Installing dependencies\n" 80 if [ $IS64BIT -eq 1]; then74 if [[ $IS64BIT == 1 ]]; then 81 75 dpkg --add-architecture i386 82 76 fi … … 101 95 echo -e "Downloading and installing management scripts\n" 102 96 wget -nv http://illy.bz/fi/7dtd/management_scripts.tar.gz -O /tmp/management_scripts.tar.gz 103 tar --touch -xzf /tmp/management_scripts.tar.gz -C / 104 105 chown root.root /etc/7dtd.conf 106 chmod 0600 /etc/7dtd.conf 107 108 chown sdtd.sdtd /home/sdtd -R 109 110 chown root.root /etc/init.d/7dtd.sh 111 chown root.root /etc/bash_completion.d/7dtd 112 chown root.root /usr/local/bin/7dtd.sh 113 chown root.root /usr/local/lib/7dtd -R 114 chmod 0755 /etc/init.d/7dtd.sh 115 chmod 0755 /etc/bash_completion.d/7dtd 116 chmod 0755 /usr/local/bin/7dtd.sh 117 chmod 0755 /usr/local/lib/7dtd -R 118 119 if [ $ISDEBIAN -eq 1 ]; then 97 tar -xzf /tmp/management_scripts.tar.gz --no-same-owner --owner=root --group=root -C / 98 chmod go-rwx /etc/7dtd.conf 99 chmod +x /etc/init.d/7dtd.sh 100 chmod +x /usr/local/bin/7dtd-* 101 if [[ $ISDEBIAN == 1 ]]; then 120 102 update-rc.d 7dtd.sh defaults 121 else122 echo123 echo "Compiling start-stop-daemon"124 cd /usr/local/lib/7dtd/start-stop-daemon125 make126 make install127 103 fi 128 104 echo -e "\n=============================================================\n\n" … … 141 117 installSteamCmdAndSDTD() { 142 118 echo -e "Installing SteamCMD and 7DtD\n" 143 7dtd.sh updateengine 119 7dtd-update.sh 120 cp -p /home/sdtd/7dtd/serverconfig.xml /home/sdtd/ 121 echo -e "\n=============================================================\n\n" 122 } 123 124 setupServerConfig() { 125 echo -e "Setting up basic 7DtD server config\n" 126 127 until [[ $public == "y" || $public == "n" ]]; do 128 read -p "Should the server be public [yn]? " public 129 done 130 if [[ "$public" == "y" ]]; then public=true; else public=false; fi 131 echo 132 133 read -p "Server name: " servername 134 echo 135 read -p "Server password (empty for none): " serverpassword 136 echo 137 138 echo "Select world to play on:" 139 select worldname in "Navezgane" "MP Forest Horde" "MP Forest Skirmish" "MP Wasteland Horde" "MP Wasteland Skirmish" "MP Wasteland War"; do 140 if [[ -n $worldname ]]; then 141 break 142 fi 143 done 144 echo 145 146 echo "Select game mode:" 147 select gamemode in "GameModeSurvival" "GameModeZombieHorde" "GameModeDeathmatch"; do 148 if [[ -n $gamemode ]]; then 149 break 150 fi 151 done 152 echo 153 154 read -p "Game name: " gamename 155 echo 156 read -p "Difficulty (0-4): " difficulty 157 echo 158 159 sed -i "s/name=\"ServerIsPublic\".*value=\"[^\"]*\"/name=\"ServerIsPublic\" value=\"$public\"/" /home/sdtd/serverconfig.xml 160 sed -i "s/name=\"ServerName\".*value=\"[^\"]*\"/name=\"ServerName\" value=\"$servername\"/" /home/sdtd/serverconfig.xml 161 sed -i "s/name=\"ServerPassword\".*value=\"[^\"]*\"/name=\"ServerPassword\" value=\"$serverpassword\"/" /home/sdtd/serverconfig.xml 162 sed -i "s/name=\"GameWorld\".*value=\"[^\"]*\"/name=\"GameWorld\" value=\"$worldname\"/" /home/sdtd/serverconfig.xml 163 sed -i "s/name=\"GameName\".*value=\"[^\"]*\"/name=\"GameName\" value=\"$gamename\"/" /home/sdtd/serverconfig.xml 164 sed -i "s/name=\"GameDifficulty\".*value=\"[^\"]*\"/name=\"GameDifficulty\" value=\"$difficulty\"/" /home/sdtd/serverconfig.xml 165 sed -i "s/name=\"GameMode\".*value=\"[^\"]*\"/name=\"GameMode\" value=\"$gamemode\"/" /home/sdtd/serverconfig.xml 166 sed -i "s/name=\"TelnetPort\".*value=\"[^\"]*\"/name=\"TelnetPort\" value=\"25003\"/" /home/sdtd/serverconfig.xml 167 144 168 echo -e "\n=============================================================\n\n" 145 169 } 146 170 147 171 addCronJobs() { 148 echo -e " Enabling backup cron job\n"172 echo -e "Adding cron jobs\n" 149 173 150 174 echo -e "By default a backup of the save folder will be created once" 151 175 echo -e " per hour. This can be changed in /etc/cron.d/7dtd-backup." 152 153 cat /etc/cron.d/7dtd-backup | tr -d '#' > /tmp/7dtd-backup 154 cp /tmp/7dtd-backup /etc/cron.d 155 176 echo -e "Memory monitor will be run every five minutes by default." 177 echo -e " This can be changed in /etc/cron.d/7dtd-check_mem." 178 179 echo "0 * * * * root /usr/local/bin/7dtd-backup.sh" > /etc/cron.d/7dtd-backup 180 echo "*/5 * * * * root /usr/local/bin/7dtd-check_mem.sh" > /etc/cron.d/7dtd-check_mem 181 182 echo -e "\nNOTE: Do not forget to edit /etc/7dtd.conf to match\nyour notification needs!" 156 183 echo -e "\n=============================================================\n\n" 157 184 } 158 185 159 186 finish() { 160 if [ $ISDEBIAN -eq 0 ]; then 161 echo 162 echo "You are not running a Debian based distribution." 163 echo "The following things should manually be checked:" 164 echo " - Existence of prerequsities" 165 echo " - Running the init-script on boot" 166 else 167 echo -e "\n ALL DONE" 168 fi 169 170 echo 171 echo -e "You can now continue setting up instances as explained on the website:" 172 echo -e " https://7dtd.illy.bz/wiki/Instance%20management" 187 echo -e "\n ALL DONE\n" 188 echo -e "You should now be able to start your 7dtd server by running\n" 189 echo -e " 7dtd-start.sh\n" 173 190 echo 174 191 echo -e "For further configuration options check:" 175 192 echo -e " /etc/7dtd.conf" 176 echo 177 echo -e "For feedback, suggestions, problems please visit the bugtracker:" 178 echo -e " https://7dtd.illy.bz/" 193 echo -e " /home/sdtd/serverconfig.xml" 194 echo 195 echo -e "For feedback, suggestions, problems please visit the forum:" 196 echo -e " http://7daystodie.com/forums/showthread.php?2188" 179 197 echo 180 198 } … … 184 202 nonDebianWarning 185 203 186 if [ $ISDEBIAN -eq 1]; then204 if [[ $ISDEBIAN == 1 ]]; then 187 205 installAptDeps 188 if [ $INSTALLOPTIONALDEPS -eq 1]; then189 #installOptionalDeps206 if [[ $INSTALLOPTIONALDEPS == 1 ]]; then 207 installOptionalDeps 190 208 echo 191 209 fi … … 195 213 setSteamLoginData 196 214 installSteamCmdAndSDTD 197 if [ $ADDCRONJOBS -eq 1]; then215 if [[ $ADDCRONJOBS == 1 ]]; then 198 216 addCronJobs 199 217 fi 218 setupServerConfig 200 219 finish 201 220 } 202 221 203 if [ -z $1]; then222 if [[ -z $1 ]]; then 204 223 showHelp 205 224 exit 0 … … 222 241 esac 223 242 done 224 if [ $RUNINSTALL -eq 1]; then243 if [[ $RUNINSTALL == 1 ]]; then 225 244 main 226 245 fi
Note:
See TracChangeset
for help on using the changeset viewer.