mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-06 14:21:18 +00:00
Split off mpmissions so there's always a pristine version of it in the server container, for when we merge XML.
Forget xmlmerge. Switch to xmlstarlet. Add the two shared objects required to get a release server running. This is just to get around having to host them/fish them up from elsewhere. Update docs.
This commit is contained in:
parent
2fc31fea37
commit
ebf961bb73
6 changed files with 49 additions and 41 deletions
|
@ -32,6 +32,7 @@ cd /serverfiles
|
|||
mv DayZServer DayZServer.release
|
||||
wget https://cdn.discordapp.com/attachments/491622000935305217/1105089599983853698/DayZServer
|
||||
chmod 755 DayZServer
|
||||
cp /files/tmp/* .
|
||||
exit
|
||||
docker compose exec server bash
|
||||
dz start # Will start a vanilla Chernarus map
|
||||
|
|
|
@ -9,7 +9,9 @@ volumes:
|
|||
serverfiles:
|
||||
# Server profile files
|
||||
profiles:
|
||||
# Server maps
|
||||
# Upstream mission files
|
||||
servermpmissions:
|
||||
# Server mission files
|
||||
mpmissions:
|
||||
# Mods
|
||||
mods:
|
||||
|
@ -21,6 +23,7 @@ services:
|
|||
volumes:
|
||||
- homedir_main:/home/user
|
||||
- serverfiles:/serverfiles
|
||||
- servermpmissions:/serverfiles/mpmissions
|
||||
- mods:/serverfiles/steamapps/workshop/content
|
||||
- mods:/mods
|
||||
- ./files:/files
|
||||
|
@ -35,6 +38,7 @@ services:
|
|||
volumes:
|
||||
- homedir_server:/home/user
|
||||
- serverfiles:/serverfiles
|
||||
- servermpmissions:/mpmissions:ro
|
||||
- mods:/mods
|
||||
- mpmissions:/serverfiles/mpmissions
|
||||
- profiles:/profiles
|
||||
|
|
|
@ -14,7 +14,6 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-reco
|
|||
ca-certificates \
|
||||
gdb \
|
||||
git \
|
||||
gwenhywfar-tools \
|
||||
jq \
|
||||
libsdl2-2.0-0 \
|
||||
libcap2 \
|
||||
|
@ -24,7 +23,8 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-reco
|
|||
procps \
|
||||
python3-pip \
|
||||
strace \
|
||||
wget
|
||||
wget \
|
||||
xmlstarlet
|
||||
|
||||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
|
||||
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
|
||||
|
|
|
@ -121,6 +121,7 @@ get_mods(){
|
|||
workshoplist+=" +workshop_download_item "${release_client_appid}" "${ID}
|
||||
mod_command_line+="@${MODNAME};"
|
||||
done
|
||||
# Remove the trailing semi-colon. This is necessary.
|
||||
if [[ ${mod_command_line} != "" ]]
|
||||
then
|
||||
mod_command_line="-mod=${mod_command_line::-1}"
|
||||
|
@ -143,6 +144,44 @@ report() {
|
|||
echo -e "========================================== End log ======================================${default}"
|
||||
}
|
||||
|
||||
mergexml(){
|
||||
# Start with the upstream XML files from a pristine mpmissions directory
|
||||
echo "Copying upstream XML files from mpmissions..."
|
||||
pushd /mpmissions > /dev/null
|
||||
for var in CFGEVENTSPAWNS CFGSPAWNABLETYPES EVENTS TYPES
|
||||
do
|
||||
find -name "${var,,}.xml" -exec cp -vf {} ${SERVER_FILES}/mpmissions/{} \;
|
||||
done
|
||||
for link in $(ls -tdr ${SERVER_PROFILE}/@* 2> /dev/null)
|
||||
do
|
||||
ID=$(readlink ${link} | awk -F/ '{print $NF}')
|
||||
MODNAME=$(get_mod_name ${ID})
|
||||
# for var in CFGEVENTSPAWNS CFGSPAWNABLETYPES EVENTS TYPES
|
||||
for var in EVENTS TYPES
|
||||
do
|
||||
if [ -f "${WORKSHOP_DIR}/${ID}/${var,,}.xml" ]
|
||||
then
|
||||
echo "Merging ${WORKSHOP_DIR}/${ID}/${var,,}.xml..."
|
||||
if ! grep -q '<?xml' ${WORKSHOP_DIR}/${ID}/${var,,}.xml
|
||||
then
|
||||
# When we have no XML or root node
|
||||
echo "The file has no root node"
|
||||
# xmlstarlet ed -s / -t elem -n "eventposdef" -m /event /eventposdef ${WORKSHOP_DIR}/${ID}/${var,,}.xml
|
||||
fi
|
||||
if ! grep -q '<?xml' ${WORKSHOP_DIR}/${ID}/${var,,}.xml
|
||||
then
|
||||
# When we have no XML node
|
||||
else
|
||||
# When it's normalized
|
||||
xmlstarlet ed -s / -t elem -n "eventposdef" -m /event /eventposdef ${WORKSHOP_DIR}/${ID}/${var,,}.xml
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
popd > /dev/null
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Start the server in the foreground
|
||||
start(){
|
||||
# Do the report on exit. Set here so that it only happens once we're starting the server, and not for other actions.
|
||||
|
@ -150,6 +189,8 @@ start(){
|
|||
report
|
||||
' EXIT
|
||||
get_mods
|
||||
mergexml
|
||||
exit 0
|
||||
cd ${SERVER_FILES}
|
||||
# Run the server. Allow docker to restart the container if the script exits with a code other than 0. This is so we can
|
||||
# safely shut the container down without killing the server within.
|
||||
|
@ -262,44 +303,6 @@ activate(){
|
|||
status
|
||||
}
|
||||
|
||||
checkXML(){
|
||||
# See if we have a template for it
|
||||
if [ -f "/files/mods/${1}/types.env" ]
|
||||
then
|
||||
echo "Found a templatate for mod ID ${1}, merging..."
|
||||
source "/files/mods/${1}/types.env"
|
||||
for xml in CFGEVENTSPAWNS CFGSPAWNABLETYPES EVENTS TYPES
|
||||
do
|
||||
NAME=$(echo ${xml} | tr A-Z a-z)
|
||||
if echo ${!xml} | grep -q http
|
||||
then
|
||||
echo "${NAME} file is remote, downloading..."
|
||||
curl -o ${WORKSHOP_DIR}/${1}/${NAME}.xml ${!xml}
|
||||
else
|
||||
echo "${NAME} file is in the mod, copying..."
|
||||
cp -vf ${!xml} ${WORKSHOP_DIR}/${1}/${NAME}.xml
|
||||
fi
|
||||
done
|
||||
# else
|
||||
# See if this mod has a types.xml in the "standard" locations
|
||||
# for path in "${WORKSHOP_DIR}/${1}/extras" "${WORKSHOP_DIR}/${1}"
|
||||
# do
|
||||
# if [ -f "${path}/types.xml" ]
|
||||
# then
|
||||
# echo -n "The mod id ${1} has a types.xml: ${path}/types.xml. "
|
||||
# if [[ ${2} = "install" ]]
|
||||
# then
|
||||
# echo "Merging to missions..."
|
||||
# else
|
||||
# echo "Removing contents from missions..."
|
||||
# fi
|
||||
# /files/mods/types.sh ${1} ${2} ${path}/types.xml
|
||||
# break
|
||||
# fi
|
||||
# done
|
||||
fi
|
||||
}
|
||||
|
||||
# Our internal RCON
|
||||
rcon(){
|
||||
exec /usr/local/py3rcon/py3rcon.py --gui ~/py3rcon.config.json
|
||||
|
|
BIN
tmp/libsteam_api.so
Executable file
BIN
tmp/libsteam_api.so
Executable file
Binary file not shown.
BIN
tmp/steamclient.so
Executable file
BIN
tmp/steamclient.so
Executable file
Binary file not shown.
Loading…
Add table
Reference in a new issue