- Files:
-
- 1 added
- 2 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
/bootstrapper/bootstrap.sh
r30 r20 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 -
/bundle_creation/makefile
r30 r20 4 4 ARCHIVE: 5 5 @echo Creating archive... 6 @tar -czf management_scripts _v`cat usr/local/lib/7dtd/VERSION | grep "version" | cut -d\ -f3`.tar.gz etc home usr6 @tar -czf management_scripts.tar.gz etc home usr 7 7 8 8 CONTENTS: SCRIPTS SSD … … 13 13 @cp -r ../scripts/* . 14 14 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 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 $@ $< 19 21 20 22 clean: 21 23 @echo Cleaning intermediate stuff... 22 -@find * -type d -exec rm -R {} \; 2>/dev/null23 @echo "Ignore that error ;)"24 @find * -type d -exec rm -R {} \; 2>/dev/null 25 @echo Ignore that error ;) -
/scripts/etc/7dtd.conf
r30 r20 1 1 #!/bin/sh 2 # Version 4 2 3 3 # User login info for Steam to download/update the engine 4 # Root directory where steamcmd should be placed 5 export STEAMCMD_ROOT=/home/sdtd/steamcmd 4 6 export STEAM_USER= 5 7 export STEAM_PASS= … … 20 22 export XMLSTARLET=/usr/bin/xmlstarlet 21 23 export PKILL=/usr/bin/pkill 22 export SSD=/sbin/start-stop-daemon23 24 -
/scripts/etc/init.d/7dtd.sh
r30 r20 1 1 #!/bin/sh 2 # Version 4 2 3 3 4 ### BEGIN INIT INFO -
/scripts/usr/local/bin/7dtd.sh
r30 r20 1 1 #!/bin/bash 2 # Version 4 2 3 3 4 . /usr/local/lib/7dtd/common.sh -
/scripts/usr/local/lib/7dtd/commands/backup.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Backups game data files. … … 23 24 touch $NewBackup 24 25 25 for H in $(getHooksFor backup); do26 $H $NewBackup27 done28 29 26 #echo "Backup folder disk usage: `$DU -sh $SDTD_BACKUP_ROOT`" 30 27 } -
/scripts/usr/local/lib/7dtd/commands/instances.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 … … 51 52 esac 52 53 done 53 echo54 54 fi 55 configEditAll configQueryValue55 configEditAll 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 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 81 configEditAll 82 echo 83 configSetAutoParameters "$INSTANCE" 84 echo 85 echo "Saving" 86 saveCurrentConfigValues "$1" 87 echo "Done" 129 88 else 130 89 echo "Instance $1 is currently running. Please stop it first." … … 161 120 } 162 121 163 sdtdSubcommandInstancesPrintConfig() {164 if [ $(isValidInstance "$1") -eq 0 ]; then165 echo "No instance given or not a valid instance!"166 return167 fi168 169 INSTANCE=$1170 loadCurrentConfigValues "$1"171 172 configEditAll printConfigValue173 }174 175 122 sdtdCommandInstances() { 176 123 SUBCMD=$1 … … 188 135 delete) 189 136 sdtdSubcommandInstancesDelete "$@" 190 ;;191 print_config)192 sdtdSubcommandInstancesPrintConfig "$@"193 137 ;; 194 138 *) … … 218 162 case $1 in 219 163 2) 220 echo "list create edit delete print_config"164 echo "list create edit delete" 221 165 ;; 222 166 3) 223 167 case $2 in 224 edit|delete |print_config)168 edit|delete) 225 169 echo "$(getInstanceList)" 226 170 ;; -
/scripts/usr/local/lib/7dtd/commands/start.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Tries to start the 7dtd instance. … … 39 40 OPTS="-quit -batchmode -nographics -configfile=$(getInstancePath $1)/config.xml -dedicated" 40 41 41 $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>&142 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>&1 42 43 sleep 1 43 44 … … 49 50 SSD_MONITOR_PID="--pidfile $(getInstancePath $1)/monitor.pid --make-pidfile" 50 51 SSD_MONITOR_DAEMON="--background" 51 $SSD--start $SSD_MONITOR_PID $SSD_MONITOR_DAEMON --exec "/usr/local/lib/7dtd/monitor-log.sh" -- "$1"52 start-stop-daemon --start $SSD_MONITOR_PID $SSD_MONITOR_DAEMON --exec "/usr/local/lib/7dtd/monitor-log.sh" -- "$1" 52 53 echo "Done!" 53 54 else -
/scripts/usr/local/lib/7dtd/commands/status.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Print status of given instance. -
/scripts/usr/local/lib/7dtd/commands/stop.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Tries to stop the 7dtd instance given as first parameter. … … 45 46 if [ $(isRunning $1) -eq 1 ]; then 46 47 echo "Failed, force closing server..." 47 $SSD--stop --pidfile $(getInstancePath $1)/7dtd.pid48 start-stop-daemon --stop --pidfile $(getInstancePath $1)/7dtd.pid 48 49 fi 49 50 -
/scripts/usr/local/lib/7dtd/commands/updateengine.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Tries to start the 7dtd instance. … … 12 13 done 13 14 14 if [ ! -e $S DTD_BASE/steamcmd]; then15 mkdir $S DTD_BASE/steamcmd15 if [ ! -e $STEAMCMD_ROOT ]; then 16 mkdir $STEAMCMD_ROOT 16 17 cd /tmp 17 18 wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz 18 tar -xvzf steamcmd_linux.tar.gz -C $S DTD_BASE/steamcmd19 cd $S DTD_BASE/steamcmd19 tar -xvzf steamcmd_linux.tar.gz -C $STEAMCMD_ROOT 20 cd $STEAMCMD_ROOT 20 21 ./steamcmd.sh +quit 21 22 fi 22 23 23 cd $S DTD_BASE/steamcmd24 cd $STEAMCMD_ROOT 24 25 25 26 ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine "+app_update 251570" validate +quit … … 29 30 cp $SDTD_BASE/engine/Install/32bit/mono.dll $SDTD_BASE/engine/7DaysToDie_Data/Mono/ 30 31 cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/ 32 cp $SDTD_BASE/msvcr100.dll $SDTD_BASE/engine/ 31 33 } 32 34 -
/scripts/usr/local/lib/7dtd/common.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Provides common functions for 7dtd-scripts. Not intended to be run directly. … … 61 62 # 1 = running 62 63 isRunning() { 63 $SSD--status --pidfile $(getInstancePath $1)/7dtd.pid64 start-stop-daemon --status --pidfile $(getInstancePath $1)/7dtd.pid 64 65 if [ $? -eq 0 ]; then 65 66 echo 1 -
/scripts/usr/local/lib/7dtd/help.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 genericHelp() { -
/scripts/usr/local/lib/7dtd/monitor-log.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 . /usr/local/lib/7dtd/common.sh -
/scripts/usr/local/lib/7dtd/playerlog.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 timestamp() { -
/scripts/usr/local/lib/7dtd/serverconfig.sh
r30 r20 1 1 #!/bin/bash 2 # Version 5 2 3 3 4 # Provides functions to query and validate values for serverconfig.xml 4 5 #################################6 ## Definition of options7 5 8 6 serverconfig_ServerPort_QueryName() { … … 686 684 687 685 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 686 ############ 856 687 listConfigValues() { 857 688 local CV … … 864 695 865 696 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 697 # 1: Option name 698 # 2: Value 872 699 isValidOptionValue() { 873 700 local TYPE=$(serverconfig_$1_Type) … … 920 747 } 921 748 922 # Query for the value of a single config option 923 # Will be stored in $configCurrent_$1 924 # Params: 925 # 1: Option name 749 # 1: Option name 750 # 2: Target variable 926 751 configQueryValue() { 927 752 local TYPE=$(serverconfig_$1_Type) … … 981 806 fi 982 807 prompt=$(printf "%s:" "$prompt") 983 prompt=$(printf "%-*s " 40"$prompt")808 prompt=$(printf "%-*s " 35 "$prompt") 984 809 985 810 while : ; do … … 997 822 export $currentValName="${config_allowed_values[$currentValName-1]}" 998 823 fi 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: 824 } 825 1007 826 # 1: Instance name 1008 827 configSetAutoParameters() { … … 1012 831 } 1013 832 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) 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 1024 866 readInstanceName() { 1025 867 until [ $(isValidInstanceName "$INSTANCE") -eq 1 ]; do … … 1035 877 } 1036 878 1037 # Undefine the current config values1038 879 unsetAllConfigValues() { 1039 880 local CV … … 1044 885 } 1045 886 1046 # Load all config values from the config.xml of the given instance1047 # Params:1048 887 # 1: Instance name 1049 888 loadCurrentConfigValues() { … … 1060 899 } 1061 900 1062 # Save all config values to the config.xml of the given instance1063 # Params:1064 901 # 1: Instance name 1065 902 saveCurrentConfigValues() { … … 1086 923 } 1087 924 1088 # Check if the config template exists1089 # Returns:1090 # 0/1: no/yes1091 925 configTemplateExists() { 1092 926 if [ -f $SDTD_BASE/templates/config.xml ]; then -
/tools/start-stop-daemon/makefile
r30 r20 2 2 gcc -Wall -Wextra -Wno-return-type -o $@ $< 3 3 4 install: start-stop-daemon5 chown root.root start-stop-daemon6 chmod 0755 start-stop-daemon7 8 4 clean: 9 5 rm start-stop-daemon
Note:
See TracChangeset
for help on using the changeset viewer.