Changeset 481 for scripts/usr/local/lib/7dtd/serverconfig.sh
- Timestamp:
- Nov 14, 2023, 2:48:08 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/usr/local/lib/7dtd/serverconfig.sh
r478 r481 20 20 ## Generic worker functions 21 21 22 23 # Set parameters for current instance that have forced values:24 # - TelnetEnabled must be set so that management scripts can work25 # - AdminFileName is made to point to the local instance admins.xml26 # - SaveGameFolder is made to point to the instance folder27 # - UserDataFolder (for GeneratedWorlds) is made to point to the <user home directory>/serverdata/28 # Params:29 # 1: Instance name30 configSetAutoParameters() {31 setConfigValue "$1" "TelnetEnabled" "true"32 setConfigValue "$1" "AdminFileName" "admins.xml"33 setConfigValue "$1" "SaveGameFolder" "$(getInstancePath "$1")"34 setConfigValue "$1" "UserDataFolder" "$SDTD_BASE/serverdata"35 }36 22 37 23 # Query for an instance name (will be saved in $INSTANCE) … … 78 64 # 3: New value 79 65 setConfigValue() { 66 local XMLSTARLET_OPTS="-L -P" 80 67 local CONF=$(getInstancePath $1)/config.xml 81 $XMLSTARLET ed -L -u "/ServerSettings/property[@name='$2']/@value" -v "$3" $CONF 68 local XPATHBASE="//property[@name='$2']" 69 70 if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@name" $CONF) ]; then 71 $XMLSTARLET ed $XMLSTARLET_OPTS \ 72 -s "/*[1]" -t elem -n "property" \ 73 -i "//property[not(@name)]" -t attr -n "name" -v "$2" \ 74 -i "$XPATHBASE" -t attr -n "value" -v "$3" \ 75 $CONF 76 else 77 $XMLSTARLET ed $XMLSTARLET_OPTS -u "$XPATHBASE/@value" -v "$3" $CONF 78 fi 82 79 }
Note:
See TracChangeset
for help on using the changeset viewer.