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:
Daniel Ceregatti 2024-03-28 08:06:19 -07:00
parent 93f65760ac
commit f6aa92d945
4 changed files with 42 additions and 20 deletions

View file

@ -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.
**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
@ -52,7 +56,7 @@ The base server files must be installed before the server can be run:
docker compose run --rm web dz install
```
This will download about 2.7G of files.
This will download about 2.9G of files.
## Run

View file

@ -158,15 +158,3 @@ get_mod_command_line(){
mod_command_line='-mod='${mod_command_line::-1}
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
}

View file

@ -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
passwordAdmin = ""; // Password to become a server admin

View file

@ -136,7 +136,10 @@ report() {
mergexml(){
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}":
find /mpmissions/${MAP} \( \
-name "cfgeconomycore.xml" \
@ -148,6 +151,23 @@ mergexml(){
-o -name "init.c" \
\) -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
# Remove any existing files, via the mod_ and custom_ prefixes
rm -rf ${MPMISSIONS}/${MAP}/mod_*
@ -329,8 +349,11 @@ mergexml(){
mkdir -p ${MPMISSIONS}/${MAP}/custom_${dir}
for file in $(ls ${SERVER_PROFILE}/custom/${dir} 2> /dev/null)
do
echo -n "Copy "
cp -av ${SERVER_PROFILE}/custom/${dir}/${file} ${MPMISSIONS}/${MAP}/custom_${dir}
if ! [ -f ${MPMISSIONS}/${MAP}/custom_${dir}/${file} ]
then
echo -n "Additional Copy "
cp -av ${SERVER_PROFILE}/custom/${dir}/${file} ${MPMISSIONS}/${MAP}/custom_${dir}
fi
done
fi
done
@ -447,8 +470,16 @@ activate(){
WW="de"
COLOR="${red}"
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)
for i in ${@}
for i in ${M}
do
# Get the mod id and name
ID=$(get_mod_id ${i} ${W})
@ -466,7 +497,6 @@ activate(){
else
echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} - is already ${WW}active"
fi
copy_keys ${W} ${ID}
echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} ${WW}activated"
popd > /dev/null
done