mirror of
				https://ceregatti.org/git/daniel/dayzdockerserver.git
				synced 2025-10-30 21:13:30 +00:00 
			
		
		
		
	Implement key copying as a factor of starting the server.
Only copy extra files from mod integrations, not ones that are handled already. Add 'all' for deactivation argument to allow a quick reset of the mods. Restore generic server name in the config example. Update docs.
This commit is contained in:
		
							parent
							
								
									93f65760ac
								
							
						
					
					
						commit
						f6aa92d945
					
				
					 4 changed files with 42 additions and 20 deletions
				
			
		|  | @ -6,7 +6,11 @@ A Linux [DayZ](https://dayz.com) server in a [Docker](https://docs.docker.com/) | ||||||
| 
 | 
 | ||||||
| The main goal is to provide a turnkey DayZ server with mod support that can be spun up with as little as a machine running Linux with Docker and Docker Compose installed.  | The main goal is to provide a turnkey DayZ server with mod support that can be spun up with as little as a machine running Linux with Docker and Docker Compose installed.  | ||||||
| 
 | 
 | ||||||
| **This is a work in progress!** | # Caveats | ||||||
|  | 
 | ||||||
|  | * Some mods are known to crash the server on startup: | ||||||
|  |   * [DayZ Expansion AI](https://steamcommunity.com/sharedfiles/filedetails/?id=2792982069) | ||||||
|  |   * [Red Falcon Flight System Heliz](https://steamcommunity.com/workshop/filedetails/?id=2692979668) | ||||||
| 
 | 
 | ||||||
| ## Configure and Build | ## Configure and Build | ||||||
| 
 | 
 | ||||||
|  | @ -52,7 +56,7 @@ The base server files must be installed before the server can be run: | ||||||
| docker compose run --rm web dz install | docker compose run --rm web dz install | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| This will download about 2.7G of files. | This will download about 2.9G of files. | ||||||
| 
 | 
 | ||||||
| ## Run | ## Run | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -158,15 +158,3 @@ get_mod_command_line(){ | ||||||
| 		mod_command_line='-mod='${mod_command_line::-1} | 		mod_command_line='-mod='${mod_command_line::-1} | ||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
| 
 |  | ||||||
| # Copy mod keys |  | ||||||
| copy_keys(){ |  | ||||||
| 	if [[ ${1} = 1 ]] |  | ||||||
| 	then |  | ||||||
| 		echo -n "Copying key file(s): " |  | ||||||
| 		find ${WORKSHOP_DIR}/${2} -name "*.bikey" -exec cp -v {} "${SERVER_FILES}/keys/" \; |  | ||||||
| 	else |  | ||||||
| 	  echo -n "Removing key file(s): " |  | ||||||
|     find ${WORKSHOP_DIR}/${2} -name "*.bikey" -execdir rm -vf "${SERVER_FILES}/keys/{}" \; |  | ||||||
| 	fi |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| hostname = "DayZ on Linux for Linux";   // Server name | hostname = "Something other than Server Name";   // Server name | ||||||
| 
 | 
 | ||||||
| password = "";              // Password to connect to the server | password = "";              // Password to connect to the server | ||||||
| passwordAdmin = "";         // Password to become a server admin | passwordAdmin = "";         // Password to become a server admin | ||||||
|  |  | ||||||
|  | @ -136,7 +136,10 @@ report() { | ||||||
| 
 | 
 | ||||||
| mergexml(){ | mergexml(){ | ||||||
| 	echo | 	echo | ||||||
| 	# First copy the pristine files from upstream | 
 | ||||||
|  | 	# Bring all base files into the working directories. | ||||||
|  | 
 | ||||||
|  | 	# Copy the pristine files from upstream | ||||||
| 	echo -e "${green}Copying upstream files into local mpmissions for map ${MAP}${default}": | 	echo -e "${green}Copying upstream files into local mpmissions for map ${MAP}${default}": | ||||||
| 	find /mpmissions/${MAP} \( \ | 	find /mpmissions/${MAP} \( \ | ||||||
| 		-name "cfgeconomycore.xml" \ | 		-name "cfgeconomycore.xml" \ | ||||||
|  | @ -148,6 +151,23 @@ mergexml(){ | ||||||
| 		-o -name "init.c" \ | 		-o -name "init.c" \ | ||||||
| 	\) -exec cp -v {} ${SERVER_FILES}{} \; | 	\) -exec cp -v {} ${SERVER_FILES}{} \; | ||||||
| 
 | 
 | ||||||
|  | 	echo | ||||||
|  | 
 | ||||||
|  | 	# Remove previously copied keys and restore the default key | ||||||
|  | 	echo -e "${green}Resetting keys${default}" | ||||||
|  | 	mv ${SERVER_FILES}/keys/dayz.bikey /tmp | ||||||
|  | 	rm -rf ${SERVER_FILES}/keys/* | ||||||
|  | 	mv /tmp/dayz.bikey ${SERVER_FILES}/keys | ||||||
|  | 
 | ||||||
|  | 	# Copy all active mod keys | ||||||
|  | 	for link in $(ls -tdr ${SERVER_PROFILE}/@* 2> /dev/null) | ||||||
|  | 	do | ||||||
|  | 		ID=$(readlink ${link} | awk -F/ '{print $NF}') | ||||||
|  | 		MODNAME=$(get_mod_name ${ID}) | ||||||
|  | 		echo -n "Copying key file(s) for mod ${MODNAME}: " | ||||||
|  | 		find ${WORKSHOP_DIR}/${ID} -name "*.bikey" -exec cp -v {} "${SERVER_FILES}/keys/" \; | ||||||
|  | 	done | ||||||
|  | 
 | ||||||
| 	# Follow https://community.bistudio.com/wiki/DayZ:Central_Economy_mission_files_modding | 	# Follow https://community.bistudio.com/wiki/DayZ:Central_Economy_mission_files_modding | ||||||
| 	# Remove any existing files, via the mod_ and custom_ prefixes | 	# Remove any existing files, via the mod_ and custom_ prefixes | ||||||
| 	rm -rf ${MPMISSIONS}/${MAP}/mod_* | 	rm -rf ${MPMISSIONS}/${MAP}/mod_* | ||||||
|  | @ -329,8 +349,11 @@ mergexml(){ | ||||||
| 				mkdir -p ${MPMISSIONS}/${MAP}/custom_${dir} | 				mkdir -p ${MPMISSIONS}/${MAP}/custom_${dir} | ||||||
| 				for file in $(ls ${SERVER_PROFILE}/custom/${dir} 2> /dev/null) | 				for file in $(ls ${SERVER_PROFILE}/custom/${dir} 2> /dev/null) | ||||||
| 				do | 				do | ||||||
| 					echo -n "Copy " | 					if ! [ -f ${MPMISSIONS}/${MAP}/custom_${dir}/${file} ] | ||||||
|  | 					then | ||||||
|  | 						echo -n "Additional Copy " | ||||||
| 						cp -av ${SERVER_PROFILE}/custom/${dir}/${file} ${MPMISSIONS}/${MAP}/custom_${dir} | 						cp -av ${SERVER_PROFILE}/custom/${dir}/${file} ${MPMISSIONS}/${MAP}/custom_${dir} | ||||||
|  | 					fi | ||||||
| 				done | 				done | ||||||
| 			fi | 			fi | ||||||
| 		done | 		done | ||||||
|  | @ -447,8 +470,16 @@ activate(){ | ||||||
| 		WW="de" | 		WW="de" | ||||||
| 		COLOR="${red}" | 		COLOR="${red}" | ||||||
| 	fi | 	fi | ||||||
|  | 	# Check if the first argument is the word 'all' | ||||||
|  | 	if [[ ${1} = 'all' ]] | ||||||
|  | 	then | ||||||
|  | 		Q=$(ls -la ${SERVER_PROFILE}/@* | wc -l) | ||||||
|  | 		M=$(seq ${Q} | tac) | ||||||
|  | 	else | ||||||
|  | 		M="${@}" | ||||||
|  | 	fi | ||||||
| 	# Loop over the rest of the argument(s) | 	# Loop over the rest of the argument(s) | ||||||
| 	for i in ${@} | 	for i in ${M} | ||||||
| 	do | 	do | ||||||
| 		# Get the mod id and name | 		# Get the mod id and name | ||||||
| 		ID=$(get_mod_id ${i} ${W}) | 		ID=$(get_mod_id ${i} ${W}) | ||||||
|  | @ -466,7 +497,6 @@ activate(){ | ||||||
| 		else | 		else | ||||||
| 			echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} - is already ${WW}active" | 			echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} - is already ${WW}active" | ||||||
| 		fi | 		fi | ||||||
| 		copy_keys ${W} ${ID} |  | ||||||
| 		echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} ${WW}activated" | 		echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} ${WW}activated" | ||||||
| 		popd > /dev/null | 		popd > /dev/null | ||||||
| 	done | 	done | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Daniel Ceregatti
						Daniel Ceregatti