mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-07 06:41:17 +00:00
Add detection of extras/types.xml and handle it if found. WIP.
This commit is contained in:
parent
e7da6d5cec
commit
86f4fe448c
1 changed files with 37 additions and 3 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eE
|
||||||
|
|
||||||
# If you want/need the server and rcon ports to be different, set them here.
|
# If you want/need the server and rcon ports to be different, set them here.
|
||||||
# The steam query port is set in serverDZ.cfg.
|
# The steam query port is set in serverDZ.cfg.
|
||||||
|
|
||||||
|
@ -428,11 +430,14 @@ add(){
|
||||||
# Set the mod name in the workshop config file, as we don't know this at the start.
|
# Set the mod name in the workshop config file, as we don't know this at the start.
|
||||||
sed -i "${WORKSHOP_CFG}" -e "s/${1}:MODNAME/${1}:${MODNAME}/"
|
sed -i "${WORKSHOP_CFG}" -e "s/${1}:MODNAME/${1}:${MODNAME}/"
|
||||||
echo -e "Mod id ${1} - ${green}${MODNAME}${default} - added"
|
echo -e "Mod id ${1} - ${green}${MODNAME}${default} - added"
|
||||||
|
checkTypesXML ${1} install
|
||||||
|
checkInstall ${1} install
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove a mod
|
# Remove a mod
|
||||||
remove(){
|
remove(){
|
||||||
|
checkTypesXML ${1} uninstall
|
||||||
|
checkInstall ${1} uninstall
|
||||||
if [ -d "${workshopfolder}/${1}" ]
|
if [ -d "${workshopfolder}/${1}" ]
|
||||||
then
|
then
|
||||||
MODNAME=$(get_mod_name ${1})
|
MODNAME=$(get_mod_name ${1})
|
||||||
|
@ -460,6 +465,7 @@ activate(){
|
||||||
if [[ ${W} = 0 ]]
|
if [[ ${W} = 0 ]]
|
||||||
then
|
then
|
||||||
WW="de"
|
WW="de"
|
||||||
|
UU="un"
|
||||||
fi
|
fi
|
||||||
get_mods
|
get_mods
|
||||||
X=1
|
X=1
|
||||||
|
@ -479,6 +485,8 @@ activate(){
|
||||||
symlink ${W} ${ID} "${NAME}"
|
symlink ${W} ${ID} "${NAME}"
|
||||||
copy_keys ${W} ${ID}
|
copy_keys ${W} ${ID}
|
||||||
echo "Mod id ${ID} - ${WW}activated"
|
echo "Mod id ${ID} - ${WW}activated"
|
||||||
|
checkTypesXML ${ID} ${UU}install
|
||||||
|
checkInstall ${ID} ${UU}install
|
||||||
else
|
else
|
||||||
echo -e "Mod id ${ID} - ${green}${NAME}${default} - is already ${WW}active"
|
echo -e "Mod id ${ID} - ${green}${NAME}${default} - is already ${WW}active"
|
||||||
fi
|
fi
|
||||||
|
@ -555,6 +563,29 @@ mod_cmd(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkTypesXML(){
|
||||||
|
# See if this mod has an extras/types.xml. If so, manage it.
|
||||||
|
if [ -f "${workshopfolder}/${1}/extras/types.xml" ]
|
||||||
|
then
|
||||||
|
echo -n "The mod id ${1} has an extras/types.xml. "
|
||||||
|
if [[ ${2} = "install" ]]
|
||||||
|
then
|
||||||
|
echo "Merging to missions..."
|
||||||
|
else
|
||||||
|
echo "Restoring original types.xml..."
|
||||||
|
fi
|
||||||
|
/files/mods/types.sh ${1} ${2}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
checkInstall(){
|
||||||
|
# See if this mod id exists in files/mods, and offer to install other server side files if an install.sh is found
|
||||||
|
if [ -f /files/mods/${1}/${2}.sh ]
|
||||||
|
then
|
||||||
|
echo "An ${2}.sh was found for mod id ${1}. Running..."
|
||||||
|
/files/mods/${1}/${2}.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
# Our internal RCON
|
# Our internal RCON
|
||||||
rcon(){
|
rcon(){
|
||||||
exec /usr/local/py3rcon/py3rcon.py --gui ~/py3rcon.config.json
|
exec /usr/local/py3rcon/py3rcon.py --gui ~/py3rcon.config.json
|
||||||
|
@ -623,6 +654,7 @@ backup(){
|
||||||
echo "Backing up ${i}..."
|
echo "Backing up ${i}..."
|
||||||
D=$(date +'%Y-%m-%d-%H-%M-%S')
|
D=$(date +'%Y-%m-%d-%H-%M-%S')
|
||||||
B="${BACKUP_DIR}/${i}-${D}"
|
B="${BACKUP_DIR}/${i}-${D}"
|
||||||
|
mkdir -p ${B}
|
||||||
cp -a "${i}" "${B}"
|
cp -a "${i}" "${B}"
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
@ -630,7 +662,9 @@ backup(){
|
||||||
|
|
||||||
# Capture the first argument and shift it off so we can pass $@ to every function
|
# Capture the first argument and shift it off so we can pass $@ to every function
|
||||||
C=${1}
|
C=${1}
|
||||||
shift
|
shift || {
|
||||||
|
usage
|
||||||
|
}
|
||||||
|
|
||||||
case "${C}" in
|
case "${C}" in
|
||||||
a|activate)
|
a|activate)
|
||||||
|
@ -684,7 +718,7 @@ case "${C}" in
|
||||||
u|update)
|
u|update)
|
||||||
update "${@}"
|
update "${@}"
|
||||||
;;
|
;;
|
||||||
**)
|
*)
|
||||||
usage "$*"
|
usage "$*"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Reference in a new issue