mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-08-09 08:33:35 +00:00
Add function that handles custom installations of mod files, e.g. MMGMightysMilitaryGear, which ships separate types files that must all be used for the mod to work.
This commit is contained in:
parent
0f2ecce170
commit
625dce94ec
3 changed files with 55 additions and 45 deletions
|
@ -114,6 +114,20 @@ get_mod_name(){
|
|||
echo -n ${NAME}
|
||||
}
|
||||
|
||||
# Lint XML files
|
||||
lint(){
|
||||
FILE=${1}
|
||||
ID=${2}
|
||||
var=${3}
|
||||
xmllint --noout ${FILE} && (
|
||||
# Keep the normalized version in the /mods directory
|
||||
echo -e "${green}The ${var,,} file passes XML lint test! Copying to install location ${WORKSHOP_DIR}/${ID}/${var,,}.xml${default}"
|
||||
cp -v ${FILE} ${WORKSHOP_DIR}/${ID}/${var,,}.xml
|
||||
) || (
|
||||
echo -e "${yellow}The ${var,,} file does not pass XML lint test! IT WAS NOT COPIED!${default}"
|
||||
)
|
||||
}
|
||||
|
||||
get_mod_id(){
|
||||
# If we were passed a valid mod id, just return it
|
||||
if [ -d "${WORKSHOP_DIR}/${1}" ]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# Merge all the XML files into a single types.xml file in the run time mods directory:
|
||||
source /files/bin/dz-common
|
||||
cd /mods/221100/2663169692/files/types
|
||||
xmlmerge -o /mods/221100/2663169692/types.xml *.xml
|
||||
xmlmerge -o /tmp/x *.xml
|
||||
lint /tmp/x 2663169692 TYPES
|
||||
|
|
16
web/bin/dz
16
web/bin/dz
|
@ -84,16 +84,9 @@ installxml(){
|
|||
xmlstarlet fo /tmp/x > /tmp/y
|
||||
mv /tmp/y /tmp/x
|
||||
fi
|
||||
xmllint --noout /tmp/x && (
|
||||
# Keep the normalized version in the /mods directory
|
||||
cp /tmp/x ${WORKSHOP_DIR}/${ID}/${var,,}.xml
|
||||
echo -e "${green}${WORKSHOP_DIR}/${ID}/${var,,}.xml passes XML lint test!${default}"
|
||||
) || (
|
||||
echo -e "${yellow}The final ${WORKSHOP_DIR}/${ID}/${var,,}.xml does not pass XML lint test! IT WAS NOT COPIED!${default}"
|
||||
)
|
||||
lint /tmp/x ${ID} ${var}
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Add a mod
|
||||
|
@ -122,8 +115,8 @@ add(){
|
|||
symlink 1 ${1} "${MODNAME}"
|
||||
echo -e "Mod id ${1} - ${green}${MODNAME}${default} - added"
|
||||
xml ${ID}
|
||||
map ${ID}
|
||||
installMod ${ID}
|
||||
map ${ID}
|
||||
}
|
||||
|
||||
# Remove a mod
|
||||
|
@ -149,11 +142,12 @@ remove(){
|
|||
|
||||
# Handle custom scripts after installing a mod
|
||||
installMod(){
|
||||
FILE="${WORKSHOP_DIR}/${1:?}/install.sh"
|
||||
FILE="${FILES}/mods/${1}/install.sh"
|
||||
if [ -f "${FILE}" ]
|
||||
then
|
||||
MODNAME=$(get_mod_name ${1})
|
||||
echo "Running custom install script ${FILE} for mod id ${1}"
|
||||
echo
|
||||
echo "Running custom install script for ${MODNAME}"
|
||||
${FILE}
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue