- Files:
-
- 3 added
- 1 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
/bootstrapper/bootstrap.sh
r20 r30 1 1 #!/bin/bash 2 3 INSTALLOPTIONALDEPS=0 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 4 10 ADDCRONJOBS=0 5 11 RUNINSTALL=0 6 12 7 DEPENDENCIES="xvfb mono-runtime rsync libxml2-utils" 8 OPTDEPENDENCIES="sendemail sendxmpp" 13 DEPENDENCIES="xvfb mono-runtime rsync xmlstarlet" 9 14 10 15 if [ -n "$(command -v apt-get)" ]; then … … 20 25 fi 21 26 22 if [ [ $IS64BIT == 1 ]]; then27 if [ $IS64BIT -eq 1 ]; then 23 28 DEPENDENCIES="$DEPENDENCIES lib32gcc1 wine:i386" 24 29 else … … 27 32 28 33 showHelp() { 29 echo "Usage: ./bootstrap.sh [-h] [- o] [-c] -i"34 echo "Usage: ./bootstrap.sh [-h] [-c] -i" 30 35 echo "Parameters:" 31 36 echo " -h Print this help screen and exit" 32 echo " -o Install optional dependencies ($OPTDEPENDENCIES)"37 # echo " -o Install optional dependencies ($OPTDEPENDENCIES)" 33 38 echo " -c Add cron jobs for save backups and memory checking" 34 39 echo " -i Required to actually start the installation" … … 41 46 echo "This will install a 7DtD server according to the information" 42 47 echo "given on:" 43 echo " http ://7daystodie.gamepedia.com/Linux_Server"48 echo " https://7dtd.illy.bz/" 44 49 echo 45 50 read -p "Press enter to continue" … … 48 53 49 54 nonDebianWarning() { 50 if [ [ $ISDEBIAN == 0 ]]; then55 if [ $ISDEBIAN -eq 0 ]; then 51 56 echo "NOTE: It seems like this system is not based on Debian." 52 57 echo "Although installation of the scripts and SteamCMD/7dtd" 53 58 echo "will work the installed management scripts will probably" 54 echo "*NOT* work out of the box and installation of dependencies" 55 echo "will fail too." 59 echo "fail because of missing dependencies. Make sure you check" 60 echo "the website regarding the prerequisites" 61 echo "(https://7dtd.illy.bz)." 56 62 echo "Do you want to continue anyway?" 57 63 select yn in "Yes" "No"; do … … 72 78 installAptDeps() { 73 79 echo -e "Installing dependencies\n" 74 if [ [ $IS64BIT == 1 ]]; then80 if [ $IS64BIT -eq 1 ]; then 75 81 dpkg --add-architecture i386 76 82 fi … … 95 101 echo -e "Downloading and installing management scripts\n" 96 102 wget -nv http://illy.bz/fi/7dtd/management_scripts.tar.gz -O /tmp/management_scripts.tar.gz 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 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 102 120 update-rc.d 7dtd.sh defaults 121 else 122 echo 123 echo "Compiling start-stop-daemon" 124 cd /usr/local/lib/7dtd/start-stop-daemon 125 make 126 make install 103 127 fi 104 128 echo -e "\n=============================================================\n\n" … … 117 141 installSteamCmdAndSDTD() { 118 142 echo -e "Installing SteamCMD and 7DtD\n" 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 143 7dtd.sh updateengine 168 144 echo -e "\n=============================================================\n\n" 169 145 } 170 146 171 147 addCronJobs() { 172 echo -e " Adding cron jobs\n"148 echo -e "Enabling backup cron job\n" 173 149 174 150 echo -e "By default a backup of the save folder will be created once" 175 151 echo -e " per hour. This can be changed in /etc/cron.d/7dtd-backup." 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!" 152 153 cat /etc/cron.d/7dtd-backup | tr -d '#' > /tmp/7dtd-backup 154 cp /tmp/7dtd-backup /etc/cron.d 155 183 156 echo -e "\n=============================================================\n\n" 184 157 } 185 158 186 159 finish() { 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" 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" 190 173 echo 191 174 echo -e "For further configuration options check:" 192 175 echo -e " /etc/7dtd.conf" 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" 176 echo 177 echo -e "For feedback, suggestions, problems please visit the bugtracker:" 178 echo -e " https://7dtd.illy.bz/" 197 179 echo 198 180 } … … 202 184 nonDebianWarning 203 185 204 if [ [ $ISDEBIAN == 1 ]]; then186 if [ $ISDEBIAN -eq 1 ]; then 205 187 installAptDeps 206 if [ [ $INSTALLOPTIONALDEPS == 1 ]]; then207 installOptionalDeps188 if [ $INSTALLOPTIONALDEPS -eq 1 ]; then 189 # installOptionalDeps 208 190 echo 209 191 fi … … 213 195 setSteamLoginData 214 196 installSteamCmdAndSDTD 215 if [ [ $ADDCRONJOBS == 1 ]]; then197 if [ $ADDCRONJOBS -eq 1 ]; then 216 198 addCronJobs 217 199 fi 218 setupServerConfig219 200 finish 220 201 } 221 202 222 if [ [ -z $1 ]]; then203 if [ -z $1 ]; then 223 204 showHelp 224 205 exit 0 … … 241 222 esac 242 223 done 243 if [ [ $RUNINSTALL == 1 ]]; then224 if [ $RUNINSTALL -eq 1 ]; then 244 225 main 245 226 fi -
/bundle_creation/makefile
r20 r30 4 4 ARCHIVE: 5 5 @echo Creating archive... 6 @tar -czf management_scripts .tar.gz etc home usr6 @tar -czf management_scripts_v`cat usr/local/lib/7dtd/VERSION | grep "version" | cut -d\ -f3`.tar.gz etc home usr 7 7 8 8 CONTENTS: SCRIPTS SSD … … 13 13 @cp -r ../scripts/* . 14 14 15 SSD: usr/local/bin/start-stop-daemon 16 17 # start-stop-daemon: 18 usr/local/bin/start-stop-daemon: ../tools/start-stop-daemon/start-stop-daemon.c 19 @echo Compiling start-stop-daemon... 20 @gcc -Wall -Wextra -Wno-return-type -Os -o $@ $< 15 SSD: 16 @echo Copying start-stop-daemon source... 17 @find ../tools -name "*~" -exec rm {} \; 18 @cp -r ../tools/start-stop-daemon usr/local/lib/7dtd 21 19 22 20 clean: 23 21 @echo Cleaning intermediate stuff... 24 @find * -type d -exec rm -R {} \; 2>/dev/null25 @echo Ignore that error ;)22 -@find * -type d -exec rm -R {} \; 2>/dev/null 23 @echo "Ignore that error ;)" -
/scripts/etc/7dtd.conf
r20 r30 1 1 #!/bin/sh 2 # Version 43 2 4 # Root directory where steamcmd should be placed 5 export STEAMCMD_ROOT=/home/sdtd/steamcmd 3 # User login info for Steam to download/update the engine 6 4 export STEAM_USER= 7 5 export STEAM_PASS= … … 22 20 export XMLSTARLET=/usr/bin/xmlstarlet 23 21 export PKILL=/usr/bin/pkill 22 export SSD=/sbin/start-stop-daemon 24 23 -
/scripts/etc/init.d/7dtd.sh
r20 r30 1 1 #!/bin/sh 2 # Version 43 2 4 3 ### BEGIN INIT INFO -
/scripts/usr/local/bin/7dtd.sh
r20 r30 1 1 #!/bin/bash 2 # Version 43 2 4 3 . /usr/local/lib/7dtd/common.sh -
/scripts/usr/local/lib/7dtd/commands/backup.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Backups game data files. … … 24 23 touch $NewBackup 25 24 25 for H in $(getHooksFor backup); do 26 $H $NewBackup 27 done 28 26 29 #echo "Backup folder disk usage: `$DU -sh $SDTD_BACKUP_ROOT`" 27 30 } -
/scripts/usr/local/lib/7dtd/commands/instances.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 … … 52 51 esac 53 52 done 54 fi 55 configEditAll 53 echo 54 fi 55 configEditAll configQueryValue 56 56 echo 57 57 configSetAutoParameters "$INSTANCE" … … 75 75 return 76 76 fi 77 77 78 78 if [ $(isRunning "$1") -eq 0 ]; then 79 79 INSTANCE=$1 80 80 loadCurrentConfigValues "$1" 81 configEditAll 82 echo 83 configSetAutoParameters "$INSTANCE" 84 echo 85 echo "Saving" 86 saveCurrentConfigValues "$1" 87 echo "Done" 81 82 while : ; do 83 echo "What section of the config do you want to edit?" 84 local i=0 85 local sects=() 86 for S in $(listConfigEditFuncs); do 87 (( i++ )) 88 sects[$i]=$S 89 printf " %2d: %s\n" $i "$S" 90 done 91 echo 92 echo " W: Save and exit" 93 echo " Q: Exit WITHOUT saving" 94 95 local SEC 96 while : ; do 97 read -p "Section number: " SEC 98 SEC=$(lowercase $SEC) 99 if [ $(isANumber $SEC) -eq 1 ]; then 100 if [ $SEC -ge 1 -a $SEC -le $i ]; then 101 break 102 fi 103 else 104 if [ "$SEC" = "q" -o "$SEC" = "w" ]; then 105 break 106 fi 107 fi 108 echo "Not a valid section number!" 109 done 110 echo 111 112 case "$SEC" in 113 q) 114 echo "Not saving" 115 break 116 ;; 117 w) 118 configSetAutoParameters "$INSTANCE" 119 echo "Saving" 120 saveCurrentConfigValues "$1" 121 echo "Done" 122 break 123 ;; 124 *) 125 configEdit${sects[$SEC]} configQueryValue 126 echo 127 esac 128 done 88 129 else 89 130 echo "Instance $1 is currently running. Please stop it first." … … 120 161 } 121 162 163 sdtdSubcommandInstancesPrintConfig() { 164 if [ $(isValidInstance "$1") -eq 0 ]; then 165 echo "No instance given or not a valid instance!" 166 return 167 fi 168 169 INSTANCE=$1 170 loadCurrentConfigValues "$1" 171 172 configEditAll printConfigValue 173 } 174 122 175 sdtdCommandInstances() { 123 176 SUBCMD=$1 … … 136 189 sdtdSubcommandInstancesDelete "$@" 137 190 ;; 191 print_config) 192 sdtdSubcommandInstancesPrintConfig "$@" 193 ;; 138 194 *) 139 195 sdtdCommandInstancesHelp … … 162 218 case $1 in 163 219 2) 164 echo "list create edit delete "220 echo "list create edit delete print_config" 165 221 ;; 166 222 3) 167 223 case $2 in 168 edit|delete )224 edit|delete|print_config) 169 225 echo "$(getInstanceList)" 170 226 ;; -
/scripts/usr/local/lib/7dtd/commands/start.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Tries to start the 7dtd instance. … … 40 39 OPTS="-quit -batchmode -nographics -configfile=$(getInstancePath $1)/config.xml -dedicated" 41 40 42 start-stop-daemon--start $SSD_PID $SSD_DAEMON $SSD_USER --chdir $SDTD_BASE/engine --exec $WINE -- $SDTD_BASE/engine/7DaysToDie.exe $OPTS > $(getInstancePath $1)/stdout.log 2>&141 $SSD --start $SSD_PID $SSD_DAEMON $SSD_USER --chdir $SDTD_BASE/engine --exec $WINE -- $SDTD_BASE/engine/7DaysToDie.exe $OPTS > $(getInstancePath $1)/stdout.log 2>&1 43 42 sleep 1 44 43 … … 50 49 SSD_MONITOR_PID="--pidfile $(getInstancePath $1)/monitor.pid --make-pidfile" 51 50 SSD_MONITOR_DAEMON="--background" 52 start-stop-daemon--start $SSD_MONITOR_PID $SSD_MONITOR_DAEMON --exec "/usr/local/lib/7dtd/monitor-log.sh" -- "$1"51 $SSD --start $SSD_MONITOR_PID $SSD_MONITOR_DAEMON --exec "/usr/local/lib/7dtd/monitor-log.sh" -- "$1" 53 52 echo "Done!" 54 53 else -
/scripts/usr/local/lib/7dtd/commands/status.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Print status of given instance. -
/scripts/usr/local/lib/7dtd/commands/stop.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Tries to stop the 7dtd instance given as first parameter. … … 46 45 if [ $(isRunning $1) -eq 1 ]; then 47 46 echo "Failed, force closing server..." 48 start-stop-daemon--stop --pidfile $(getInstancePath $1)/7dtd.pid47 $SSD --stop --pidfile $(getInstancePath $1)/7dtd.pid 49 48 fi 50 49 -
/scripts/usr/local/lib/7dtd/commands/updateengine.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Tries to start the 7dtd instance. … … 13 12 done 14 13 15 if [ ! -e $S TEAMCMD_ROOT]; then16 mkdir $S TEAMCMD_ROOT14 if [ ! -e $SDTD_BASE/steamcmd ]; then 15 mkdir $SDTD_BASE/steamcmd 17 16 cd /tmp 18 17 wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz 19 tar -xvzf steamcmd_linux.tar.gz -C $S TEAMCMD_ROOT20 cd $S TEAMCMD_ROOT18 tar -xvzf steamcmd_linux.tar.gz -C $SDTD_BASE/steamcmd 19 cd $SDTD_BASE/steamcmd 21 20 ./steamcmd.sh +quit 22 21 fi 23 22 24 cd $S TEAMCMD_ROOT23 cd $SDTD_BASE/steamcmd 25 24 26 25 ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine "+app_update 251570" validate +quit … … 30 29 cp $SDTD_BASE/engine/Install/32bit/mono.dll $SDTD_BASE/engine/7DaysToDie_Data/Mono/ 31 30 cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/ 32 cp $SDTD_BASE/msvcr100.dll $SDTD_BASE/engine/33 31 } 34 32 -
/scripts/usr/local/lib/7dtd/common.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Provides common functions for 7dtd-scripts. Not intended to be run directly. … … 62 61 # 1 = running 63 62 isRunning() { 64 start-stop-daemon--status --pidfile $(getInstancePath $1)/7dtd.pid63 $SSD --status --pidfile $(getInstancePath $1)/7dtd.pid 65 64 if [ $? -eq 0 ]; then 66 65 echo 1 -
/scripts/usr/local/lib/7dtd/help.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 genericHelp() { -
/scripts/usr/local/lib/7dtd/monitor-log.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 . /usr/local/lib/7dtd/common.sh -
/scripts/usr/local/lib/7dtd/playerlog.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 timestamp() { -
/scripts/usr/local/lib/7dtd/serverconfig.sh
r20 r30 1 1 #!/bin/bash 2 # Version 53 2 4 3 # Provides functions to query and validate values for serverconfig.xml 4 5 ################################# 6 ## Definition of options 5 7 6 8 serverconfig_ServerPort_QueryName() { … … 684 686 685 687 686 ############ 688 ################################# 689 ## Edit option functions 690 691 configEditServer() { 692 local CV 693 694 echo "Server" 695 echo "--------------------------------" 696 for CV in \ 697 ServerName ServerPassword ServerIsPublic ServerPort ServerMaxPlayerCount \ 698 DisableNAT \ 699 ; do 700 $1 $CV 701 done 702 echo 703 } 704 705 configEditRemoteControl() { 706 local CV 707 708 echo "Remote control" 709 echo "--------------------------------" 710 for CV in \ 711 ControlPanelEnabled ControlPanelPort ControlPanelPassword \ 712 TelnetPort TelnetPassword \ 713 ; do 714 if [ "$CV" = "TelnetPort" ]; then 715 echo 716 echo "NOTE: Telnet will always be enabled for management purposes!" 717 echo "Make sure you block external access to this port!" 718 echo 719 fi 720 $1 $CV 721 done 722 echo 723 } 724 725 configEditGameType() { 726 local CV 727 728 echo "Game type" 729 echo "--------------------------------" 730 for CV in \ 731 GameName GameWorld GameMode \ 732 ; do 733 $1 $CV 734 done 735 echo 736 } 737 738 configEditGameTypeSpecific() { 739 local CV 740 741 echo "Options for specific game types" 742 echo "--------------------------------" 743 for CV in \ 744 DayCount FragLimit MatchLength RebuildMap \ 745 ; do 746 $1 $CV 747 done 748 echo 749 } 750 751 configEditGeneric() { 752 local CV 753 754 echo "Generic options" 755 echo "--------------------------------" 756 for CV in \ 757 ShowAllPlayersOnMap FriendlyFire BuildCreate \ 758 BlockDurabilityModifier \ 759 ; do 760 $1 $CV 761 done 762 echo 763 } 764 765 configEditDropLoot() { 766 local CV 767 768 echo "Drop and Loot" 769 echo "--------------------------------" 770 for CV in \ 771 DropOnDeath DropOnQuit \ 772 LootAbundance LootRespawnDays AirDropFrequency \ 773 ; do 774 $1 $CV 775 done 776 echo 777 } 778 779 configEditTimes() { 780 local CV 781 782 echo "Times / Durations" 783 echo "--------------------------------" 784 for CV in \ 785 CraftTimer LootTimer \ 786 DayNightLength NightPercentage \ 787 ; do 788 $1 $CV 789 done 790 echo 791 } 792 793 configEditDifficulty() { 794 local CV 795 796 echo "Difficulty" 797 echo "--------------------------------" 798 for CV in \ 799 GameDifficulty ZombiesRun \ 800 PlayerDamageGiven PlayerDamageRecieved EnemySenseMemory EnemySpawnMode EnemyDifficulty \ 801 ; do 802 $1 $CV 803 done 804 echo 805 } 806 807 configEditLandClaim() { 808 local CV 809 810 echo "Land claim options" 811 echo "--------------------------------" 812 for CV in \ 813 LandClaimSize LandClaimDeadZone LandClaimExpiryTime LandClaimDecayMode \ 814 LandClaimOnlineDurabilityModifier LandClaimOfflineDurabilityModifier \ 815 ; do 816 $1 $CV 817 done 818 echo 819 } 820 821 configEditAll() { 822 configEditServer "$1" 823 configEditRemoteControl "$1" 824 configEditGameType "$1" 825 configEditGameTypeSpecific "$1" 826 configEditGeneric "$1" 827 configEditDropLoot "$1" 828 configEditTimes "$1" 829 configEditDifficulty "$1" 830 configEditLandClaim "$1" 831 } 832 833 834 835 836 837 ################################# 838 ## Generic worker functions 839 840 841 # List all defined config editing parts 842 # Returns: 843 # List of config funcs 844 listConfigEditFuncs() { 845 local CV 846 for CV in $(declare -F | cut -d\ -f3 | grep "^configEdit.*$"); do 847 CV=${CV#configEdit} 848 printf "%s " "$CV" 849 done 850 } 851 852 853 # List all defined config options 854 # Returns: 855 # List of defined config options 687 856 listConfigValues() { 688 857 local CV … … 695 864 696 865 697 # 1: Option name 698 # 2: Value 866 # Validate the given value for the given option 867 # Params: 868 # 1: Option name 869 # 2: Value 870 # Returns: 871 # 0/1: invalid/valid 699 872 isValidOptionValue() { 700 873 local TYPE=$(serverconfig_$1_Type) … … 747 920 } 748 921 749 # 1: Option name 750 # 2: Target variable 922 # Query for the value of a single config option 923 # Will be stored in $configCurrent_$1 924 # Params: 925 # 1: Option name 751 926 configQueryValue() { 752 927 local TYPE=$(serverconfig_$1_Type) … … 806 981 fi 807 982 prompt=$(printf "%s:" "$prompt") 808 prompt=$(printf "%-*s " 35"$prompt")983 prompt=$(printf "%-*s " 40 "$prompt") 809 984 810 985 while : ; do … … 822 997 export $currentValName="${config_allowed_values[$currentValName-1]}" 823 998 fi 824 } 825 999 echo 1000 } 1001 1002 # Set parameters for current instance that have forced values: 1003 # - TelnetEnabled must be set so that management scripts can work 1004 # - AdminFileName is made to point to the local instance admins.xml 1005 # - SaveGameFolder is made to point to the instance folder 1006 # Params: 826 1007 # 1: Instance name 827 1008 configSetAutoParameters() { … … 831 1012 } 832 1013 833 configEditAll() { 834 local CV 835 for CV in \ 836 ServerName ServerPort ServerIsPublic ServerPassword ServerMaxPlayerCount \ 837 DisableNAT \ 838 ControlPanelEnabled ControlPanelPort ControlPanelPassword \ 839 TelnetPort TelnetPassword \ 840 GameWorld GameName GameMode \ 841 ShowAllPlayersOnMap FriendlyFire BuildCreate \ 842 DayCount FragLimit MatchLength RebuildMap \ 843 DropOnDeath DropOnQuit \ 844 LootAbundance LootRespawnDays AirDropFrequency \ 845 CraftTimer LootTimer \ 846 DayNightLength NightPercentage \ 847 GameDifficulty ZombiesRun \ 848 PlayerDamageGiven PlayerDamageRecieved EnemySenseMemory EnemySpawnMode EnemyDifficulty \ 849 BlockDurabilityModifier \ 850 LandClaimSize LandClaimDeadZone LandClaimExpiryTime LandClaimDecayMode \ 851 LandClaimOnlineDurabilityModifier LandClaimOfflineDurabilityModifier \ 852 ; do 853 configQueryValue $CV 854 echo 855 done 856 } 857 858 printCurrentConfig() { 859 local CV 860 for CV in $(listConfigValues); do 861 local currentValName=configCurrent_$CV 862 printf "%-20s = %s\n" "$CV" "${!currentValName}" 863 done 864 } 865 1014 1015 # Print defined config value 1016 # Params: 1017 # 1: Config option 1018 printConfigValue() { 1019 local currentValName=configCurrent_$1 1020 printf "%-25s = %s\n" "$(serverconfig_$1_QueryName)" "${!currentValName}" 1021 } 1022 1023 # Query for an instance name (will be saved in $INSTANCE) 866 1024 readInstanceName() { 867 1025 until [ $(isValidInstanceName "$INSTANCE") -eq 1 ]; do … … 877 1035 } 878 1036 1037 # Undefine the current config values 879 1038 unsetAllConfigValues() { 880 1039 local CV … … 885 1044 } 886 1045 1046 # Load all config values from the config.xml of the given instance 1047 # Params: 887 1048 # 1: Instance name 888 1049 loadCurrentConfigValues() { … … 899 1060 } 900 1061 1062 # Save all config values to the config.xml of the given instance 1063 # Params: 901 1064 # 1: Instance name 902 1065 saveCurrentConfigValues() { … … 923 1086 } 924 1087 1088 # Check if the config template exists 1089 # Returns: 1090 # 0/1: no/yes 925 1091 configTemplateExists() { 926 1092 if [ -f $SDTD_BASE/templates/config.xml ]; then -
/tools/start-stop-daemon/makefile
r20 r30 2 2 gcc -Wall -Wextra -Wno-return-type -o $@ $< 3 3 4 install: start-stop-daemon 5 chown root.root start-stop-daemon 6 chmod 0755 start-stop-daemon 7 4 8 clean: 5 9 rm start-stop-daemon
Note:
See TracChangeset
for help on using the changeset viewer.