[19] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # Provides functions to query and validate values for serverconfig.xml
|
---|
| 4 |
|
---|
[23] | 5 | #################################
|
---|
| 6 | ## Definition of options
|
---|
| 7 |
|
---|
[19] | 8 | serverconfig_ServerPort_QueryName() {
|
---|
| 9 | echo "Base Port"
|
---|
| 10 | }
|
---|
| 11 | serverconfig_ServerPort_Type() {
|
---|
| 12 | echo "number"
|
---|
| 13 | }
|
---|
| 14 | serverconfig_ServerPort_Default() {
|
---|
| 15 | echo "25000"
|
---|
| 16 | }
|
---|
| 17 | serverconfig_ServerPort_Range() {
|
---|
| 18 | echo "1024-65533"
|
---|
| 19 | }
|
---|
| 20 | serverconfig_ServerPort_Validate() {
|
---|
| 21 | local I=${INSTANCE:-!}
|
---|
| 22 | if [ $(checkGamePortUsed "$1" "$I") -eq 0 ]; then
|
---|
| 23 | echo "1"
|
---|
| 24 | else
|
---|
| 25 | echo "0"
|
---|
| 26 | fi
|
---|
| 27 | }
|
---|
| 28 | serverconfig_ServerPort_ErrorMessage() {
|
---|
| 29 | echo "Illegal port number or port already in use by another instance."
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | serverconfig_ServerIsPublic_QueryName() {
|
---|
| 35 | echo "Public server"
|
---|
| 36 | }
|
---|
| 37 | serverconfig_ServerIsPublic_Type() {
|
---|
| 38 | echo "boolean"
|
---|
| 39 | }
|
---|
| 40 | serverconfig_ServerIsPublic_Default() {
|
---|
| 41 | echo "true"
|
---|
| 42 | }
|
---|
| 43 | serverconfig_ServerIsPublic_ErrorMessage() {
|
---|
| 44 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | serverconfig_ServerName_QueryName() {
|
---|
| 50 | echo "Server name"
|
---|
| 51 | }
|
---|
| 52 | serverconfig_ServerName_Type() {
|
---|
| 53 | echo "string"
|
---|
| 54 | }
|
---|
| 55 | serverconfig_ServerName_Validate() {
|
---|
| 56 | if [ ! -z "$1" ]; then
|
---|
| 57 | echo "1"
|
---|
| 58 | else
|
---|
| 59 | echo "0"
|
---|
| 60 | fi
|
---|
| 61 | }
|
---|
| 62 | serverconfig_ServerName_ErrorMessage() {
|
---|
| 63 | echo "Server name cannot be empty."
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 |
|
---|
[204] | 68 | serverconfig_ServerDescription_QueryName() {
|
---|
| 69 | echo "Server description"
|
---|
| 70 | }
|
---|
| 71 | serverconfig_ServerDescription_Type() {
|
---|
| 72 | echo "string"
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | serverconfig_ServerWebsiteURL_QueryName() {
|
---|
| 78 | echo "Server website URL"
|
---|
| 79 | }
|
---|
| 80 | serverconfig_ServerWebsiteURL_Type() {
|
---|
| 81 | echo "string"
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 |
|
---|
[19] | 86 | serverconfig_ServerPassword_QueryName() {
|
---|
| 87 | echo "Server password"
|
---|
| 88 | }
|
---|
| 89 | serverconfig_ServerPassword_Type() {
|
---|
| 90 | echo "string"
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | serverconfig_ServerMaxPlayerCount_QueryName() {
|
---|
| 96 | echo "Max players"
|
---|
| 97 | }
|
---|
| 98 | serverconfig_ServerMaxPlayerCount_Type() {
|
---|
| 99 | echo "number"
|
---|
| 100 | }
|
---|
| 101 | serverconfig_ServerMaxPlayerCount_Default() {
|
---|
| 102 | echo "4"
|
---|
| 103 | }
|
---|
| 104 | serverconfig_ServerMaxPlayerCount_Range() {
|
---|
| 105 | echo "1-64"
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | serverconfig_GameWorld_QueryName() {
|
---|
| 111 | echo "World name"
|
---|
| 112 | }
|
---|
| 113 | serverconfig_GameWorld_Type() {
|
---|
| 114 | echo "enum"
|
---|
| 115 | }
|
---|
| 116 | serverconfig_GameWorld_Default() {
|
---|
| 117 | echo "1"
|
---|
| 118 | }
|
---|
| 119 | serverconfig_GameWorld_Values() {
|
---|
[119] | 120 | config_allowed_values=("Random Gen" "Navezgane" "MP Wasteland Horde" "MP Wasteland Skirmish" "MP Wasteland War")
|
---|
[19] | 121 | }
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | serverconfig_GameName_QueryName() {
|
---|
[204] | 126 | echo "Random gen seed"
|
---|
[19] | 127 | }
|
---|
| 128 | serverconfig_GameName_Type() {
|
---|
| 129 | echo "string"
|
---|
| 130 | }
|
---|
| 131 | serverconfig_GameName_Validate() {
|
---|
| 132 | if [ ! -z "$1" ]; then
|
---|
| 133 | echo "1"
|
---|
| 134 | else
|
---|
| 135 | echo "0"
|
---|
| 136 | fi
|
---|
| 137 | }
|
---|
| 138 | serverconfig_GameName_ErrorMessage() {
|
---|
[204] | 139 | echo "Seed cannot be empty."
|
---|
[19] | 140 | }
|
---|
| 141 |
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | serverconfig_GameDifficulty_QueryName() {
|
---|
[204] | 145 | echo "Difficulty (+ damage given / received)"
|
---|
[19] | 146 | }
|
---|
| 147 | serverconfig_GameDifficulty_Type() {
|
---|
| 148 | echo "number"
|
---|
| 149 | }
|
---|
| 150 | serverconfig_GameDifficulty_Default() {
|
---|
| 151 | echo "2"
|
---|
| 152 | }
|
---|
| 153 | serverconfig_GameDifficulty_Range() {
|
---|
[204] | 154 | echo "0-5"
|
---|
[19] | 155 | }
|
---|
| 156 | serverconfig_GameDifficulty_Values() {
|
---|
[204] | 157 | config_allowed_values=("Scavenger (200% / 50%)" "Adventurer (150% / 75%)" "Nomad (100% / 100%)" "Warrior (75% / 150%)" "Survivalist (50% / 200%)" "Insane (25% / 250%)")
|
---|
[19] | 158 | }
|
---|
| 159 |
|
---|
| 160 |
|
---|
| 161 |
|
---|
| 162 | serverconfig_GameMode_QueryName() {
|
---|
| 163 | echo "Game mode"
|
---|
| 164 | }
|
---|
| 165 | serverconfig_GameMode_Type() {
|
---|
| 166 | echo "enum"
|
---|
| 167 | }
|
---|
| 168 | serverconfig_GameMode_Default() {
|
---|
| 169 | echo "1"
|
---|
| 170 | }
|
---|
| 171 | serverconfig_GameMode_Values() {
|
---|
| 172 | config_allowed_values=("GameModeSurvivalMP" "GameModeSurvivalSP")
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 |
|
---|
| 176 |
|
---|
| 177 | serverconfig_ZombiesRun_QueryName() {
|
---|
| 178 | echo "Zombies run"
|
---|
| 179 | }
|
---|
| 180 | serverconfig_ZombiesRun_Type() {
|
---|
| 181 | echo "number"
|
---|
| 182 | }
|
---|
| 183 | serverconfig_ZombiesRun_Default() {
|
---|
| 184 | echo "0"
|
---|
| 185 | }
|
---|
| 186 | serverconfig_ZombiesRun_Range() {
|
---|
| 187 | echo "0-2"
|
---|
| 188 | }
|
---|
| 189 | serverconfig_ZombiesRun_Values() {
|
---|
| 190 | config_allowed_values=("Default day/night walk/run" "Never run" "Always run")
|
---|
| 191 | }
|
---|
| 192 |
|
---|
| 193 |
|
---|
| 194 |
|
---|
| 195 | serverconfig_BuildCreate_QueryName() {
|
---|
| 196 | echo "Item spawn menu"
|
---|
| 197 | }
|
---|
| 198 | serverconfig_BuildCreate_Type() {
|
---|
| 199 | echo "boolean"
|
---|
| 200 | }
|
---|
| 201 | serverconfig_BuildCreate_Default() {
|
---|
[204] | 202 | echo "false"
|
---|
[19] | 203 | }
|
---|
| 204 | serverconfig_BuildCreate_ErrorMessage() {
|
---|
| 205 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 |
|
---|
| 209 |
|
---|
| 210 | serverconfig_DayNightLength_QueryName() {
|
---|
| 211 | echo "Length of one day"
|
---|
| 212 | }
|
---|
| 213 | serverconfig_DayNightLength_Type() {
|
---|
| 214 | echo "number"
|
---|
| 215 | }
|
---|
| 216 | serverconfig_DayNightLength_Default() {
|
---|
[204] | 217 | echo "40"
|
---|
[19] | 218 | }
|
---|
| 219 |
|
---|
| 220 |
|
---|
| 221 |
|
---|
| 222 | serverconfig_FriendlyFire_QueryName() {
|
---|
| 223 | echo "Friendly fire"
|
---|
| 224 | }
|
---|
| 225 | serverconfig_FriendlyFire_Type() {
|
---|
| 226 | echo "boolean"
|
---|
| 227 | }
|
---|
| 228 | serverconfig_FriendlyFire_Default() {
|
---|
| 229 | echo "false"
|
---|
| 230 | }
|
---|
| 231 | serverconfig_FriendlyFire_ErrorMessage() {
|
---|
| 232 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 |
|
---|
| 236 |
|
---|
| 237 | serverconfig_ControlPanelEnabled_QueryName() {
|
---|
| 238 | echo "Enable control panel"
|
---|
| 239 | }
|
---|
| 240 | serverconfig_ControlPanelEnabled_Type() {
|
---|
| 241 | echo "boolean"
|
---|
| 242 | }
|
---|
| 243 | serverconfig_ControlPanelEnabled_Default() {
|
---|
| 244 | echo "false"
|
---|
| 245 | }
|
---|
| 246 | serverconfig_ControlPanelEnabled_ErrorMessage() {
|
---|
| 247 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 |
|
---|
| 251 |
|
---|
| 252 | serverconfig_ControlPanelPort_QueryName() {
|
---|
| 253 | echo "Control panel port"
|
---|
| 254 | }
|
---|
| 255 | serverconfig_ControlPanelPort_Type() {
|
---|
| 256 | echo "number"
|
---|
| 257 | }
|
---|
| 258 | serverconfig_ControlPanelPort_Default() {
|
---|
| 259 | echo "8080"
|
---|
| 260 | }
|
---|
| 261 | serverconfig_ControlPanelPort_Range() {
|
---|
| 262 | echo "1024-65535"
|
---|
| 263 | }
|
---|
| 264 | serverconfig_ControlPanelPort_Validate() {
|
---|
| 265 | local I=${INSTANCE:-!}
|
---|
| 266 | if [ $(checkTCPPortUsed "$1" "$I") -eq 0 ]; then
|
---|
| 267 | echo "1"
|
---|
| 268 | else
|
---|
| 269 | echo "0"
|
---|
| 270 | fi
|
---|
| 271 | }
|
---|
| 272 | serverconfig_ControlPanelPort_ErrorMessage() {
|
---|
| 273 | echo "Illegal port number or port already in use by another instance."
|
---|
| 274 | }
|
---|
| 275 |
|
---|
| 276 |
|
---|
| 277 |
|
---|
| 278 | serverconfig_ControlPanelPassword_QueryName() {
|
---|
| 279 | echo "Control panel password"
|
---|
| 280 | }
|
---|
| 281 | serverconfig_ControlPanelPassword_Type() {
|
---|
| 282 | echo "string"
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 |
|
---|
| 286 |
|
---|
| 287 | serverconfig_TelnetPort_QueryName() {
|
---|
| 288 | echo "Telnet port"
|
---|
| 289 | }
|
---|
| 290 | serverconfig_TelnetPort_Type() {
|
---|
| 291 | echo "number"
|
---|
| 292 | }
|
---|
| 293 | serverconfig_TelnetPort_Default() {
|
---|
| 294 | echo "8081"
|
---|
| 295 | }
|
---|
| 296 | serverconfig_TelnetPort_Range() {
|
---|
| 297 | echo "1024-65535"
|
---|
| 298 | }
|
---|
| 299 | serverconfig_TelnetPort_Validate() {
|
---|
| 300 | local I=${INSTANCE:-!}
|
---|
| 301 | if [ $(checkTCPPortUsed "$1" "$I") -eq 0 ]; then
|
---|
| 302 | echo "1"
|
---|
| 303 | else
|
---|
| 304 | echo "0"
|
---|
| 305 | fi
|
---|
| 306 | }
|
---|
| 307 | serverconfig_TelnetPort_ErrorMessage() {
|
---|
| 308 | echo "Illegal port number or port already in use by another instance."
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 |
|
---|
| 312 |
|
---|
| 313 | serverconfig_TelnetPassword_QueryName() {
|
---|
| 314 | echo "Telnet password"
|
---|
| 315 | }
|
---|
| 316 | serverconfig_TelnetPassword_Type() {
|
---|
| 317 | echo "string"
|
---|
| 318 | }
|
---|
| 319 |
|
---|
| 320 |
|
---|
| 321 |
|
---|
| 322 | serverconfig_DisableNAT_QueryName() {
|
---|
| 323 | echo "Disable NAT"
|
---|
| 324 | }
|
---|
| 325 | serverconfig_DisableNAT_Type() {
|
---|
| 326 | echo "boolean"
|
---|
| 327 | }
|
---|
| 328 | serverconfig_DisableNAT_Default() {
|
---|
| 329 | echo "true"
|
---|
| 330 | }
|
---|
| 331 | serverconfig_DisableNAT_ErrorMessage() {
|
---|
| 332 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 |
|
---|
| 336 |
|
---|
| 337 |
|
---|
| 338 | serverconfig_DropOnDeath_QueryName() {
|
---|
| 339 | echo "Drop on Death"
|
---|
| 340 | }
|
---|
| 341 | serverconfig_DropOnDeath_Type() {
|
---|
| 342 | echo "number"
|
---|
| 343 | }
|
---|
| 344 | serverconfig_DropOnDeath_Default() {
|
---|
| 345 | echo "0"
|
---|
| 346 | }
|
---|
| 347 | serverconfig_DropOnDeath_Range() {
|
---|
| 348 | echo "0-3"
|
---|
| 349 | }
|
---|
| 350 | serverconfig_DropOnDeath_Values() {
|
---|
| 351 | config_allowed_values=("Everything" "Toolbelt only" "Backpack only" "Delete all")
|
---|
| 352 | }
|
---|
| 353 |
|
---|
| 354 |
|
---|
| 355 | serverconfig_DropOnQuit_QueryName() {
|
---|
| 356 | echo "Drop on Quit"
|
---|
| 357 | }
|
---|
| 358 | serverconfig_DropOnQuit_Type() {
|
---|
| 359 | echo "number"
|
---|
| 360 | }
|
---|
| 361 | serverconfig_DropOnQuit_Default() {
|
---|
[204] | 362 | echo "1"
|
---|
[19] | 363 | }
|
---|
| 364 | serverconfig_DropOnQuit_Range() {
|
---|
| 365 | echo "0-3"
|
---|
| 366 | }
|
---|
| 367 | serverconfig_DropOnQuit_Values() {
|
---|
| 368 | config_allowed_values=("Nothing" "Everything" "Toolbelt only" "Backpack only")
|
---|
| 369 | }
|
---|
| 370 |
|
---|
| 371 |
|
---|
| 372 |
|
---|
| 373 |
|
---|
| 374 | serverconfig_CraftTimer_QueryName() {
|
---|
| 375 | echo "Craft speed"
|
---|
| 376 | }
|
---|
| 377 | serverconfig_CraftTimer_Type() {
|
---|
| 378 | echo "number"
|
---|
| 379 | }
|
---|
| 380 | serverconfig_CraftTimer_Default() {
|
---|
| 381 | echo "1"
|
---|
| 382 | }
|
---|
| 383 | serverconfig_CraftTimer_Range() {
|
---|
| 384 | echo "0-2"
|
---|
| 385 | }
|
---|
| 386 | serverconfig_CraftTimer_Values() {
|
---|
| 387 | config_allowed_values=("Instant" "Normal" "Double")
|
---|
| 388 | }
|
---|
| 389 |
|
---|
| 390 |
|
---|
| 391 | serverconfig_LootTimer_QueryName() {
|
---|
| 392 | echo "Loot open speed"
|
---|
| 393 | }
|
---|
| 394 | serverconfig_LootTimer_Type() {
|
---|
| 395 | echo "number"
|
---|
| 396 | }
|
---|
| 397 | serverconfig_LootTimer_Default() {
|
---|
| 398 | echo "1"
|
---|
| 399 | }
|
---|
| 400 | serverconfig_LootTimer_Range() {
|
---|
| 401 | echo "0-2"
|
---|
| 402 | }
|
---|
| 403 | serverconfig_LootTimer_Values() {
|
---|
| 404 | config_allowed_values=("Instant" "Normal" "Double")
|
---|
| 405 | }
|
---|
| 406 |
|
---|
| 407 |
|
---|
| 408 |
|
---|
| 409 |
|
---|
| 410 | serverconfig_EnemySenseMemory_QueryName() {
|
---|
| 411 | echo "Sense memory (seconds)"
|
---|
| 412 | }
|
---|
| 413 | serverconfig_EnemySenseMemory_Type() {
|
---|
| 414 | echo "number"
|
---|
| 415 | }
|
---|
| 416 | serverconfig_EnemySenseMemory_Default() {
|
---|
| 417 | echo "60"
|
---|
| 418 | }
|
---|
| 419 |
|
---|
| 420 |
|
---|
| 421 | serverconfig_EnemySpawnMode_QueryName() {
|
---|
| 422 | echo "Spawn mode"
|
---|
| 423 | }
|
---|
| 424 | serverconfig_EnemySpawnMode_Type() {
|
---|
| 425 | echo "number"
|
---|
| 426 | }
|
---|
| 427 | serverconfig_EnemySpawnMode_Default() {
|
---|
| 428 | echo "3"
|
---|
| 429 | }
|
---|
| 430 | serverconfig_EnemySpawnMode_Range() {
|
---|
| 431 | echo "0-5"
|
---|
| 432 | }
|
---|
| 433 | serverconfig_EnemySpawnMode_Values() {
|
---|
| 434 | config_allowed_values=("Disabled" "50%" "75%" "100%" "125%" "150%")
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 |
|
---|
| 438 | serverconfig_EnemyDifficulty_QueryName() {
|
---|
| 439 | echo "Enemy difficulty"
|
---|
| 440 | }
|
---|
| 441 | serverconfig_EnemyDifficulty_Type() {
|
---|
| 442 | echo "number"
|
---|
| 443 | }
|
---|
| 444 | serverconfig_EnemyDifficulty_Default() {
|
---|
| 445 | echo "0"
|
---|
| 446 | }
|
---|
| 447 | serverconfig_EnemyDifficulty_Range() {
|
---|
| 448 | echo "0-1"
|
---|
| 449 | }
|
---|
| 450 | serverconfig_EnemyDifficulty_Values() {
|
---|
| 451 | config_allowed_values=("Normal" "Feral")
|
---|
| 452 | }
|
---|
| 453 |
|
---|
| 454 |
|
---|
| 455 |
|
---|
| 456 |
|
---|
| 457 | serverconfig_NightPercentage_QueryName() {
|
---|
| 458 | echo "Night percentage"
|
---|
| 459 | }
|
---|
| 460 | serverconfig_NightPercentage_Type() {
|
---|
| 461 | echo "number"
|
---|
| 462 | }
|
---|
| 463 | serverconfig_NightPercentage_Default() {
|
---|
| 464 | echo "35"
|
---|
| 465 | }
|
---|
| 466 | serverconfig_NightPercentage_Range() {
|
---|
| 467 | echo "10-90"
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 |
|
---|
| 471 |
|
---|
| 472 | serverconfig_BlockDurabilityModifier_QueryName() {
|
---|
| 473 | echo "Block durability (%)"
|
---|
| 474 | }
|
---|
| 475 | serverconfig_BlockDurabilityModifier_Type() {
|
---|
| 476 | echo "number"
|
---|
| 477 | }
|
---|
| 478 | serverconfig_BlockDurabilityModifier_Default() {
|
---|
| 479 | echo "100"
|
---|
| 480 | }
|
---|
| 481 |
|
---|
| 482 |
|
---|
| 483 |
|
---|
| 484 |
|
---|
| 485 | serverconfig_LootAbundance_QueryName() {
|
---|
| 486 | echo "Loot abundance (%)"
|
---|
| 487 | }
|
---|
| 488 | serverconfig_LootAbundance_Type() {
|
---|
| 489 | echo "number"
|
---|
| 490 | }
|
---|
| 491 | serverconfig_LootAbundance_Default() {
|
---|
| 492 | echo "100"
|
---|
| 493 | }
|
---|
| 494 |
|
---|
| 495 |
|
---|
| 496 | serverconfig_LootRespawnDays_QueryName() {
|
---|
| 497 | echo "Loot respawn delay (days)"
|
---|
| 498 | }
|
---|
| 499 | serverconfig_LootRespawnDays_Type() {
|
---|
| 500 | echo "number"
|
---|
| 501 | }
|
---|
| 502 | serverconfig_LootRespawnDays_Default() {
|
---|
| 503 | echo "7"
|
---|
| 504 | }
|
---|
| 505 |
|
---|
| 506 |
|
---|
| 507 |
|
---|
| 508 |
|
---|
| 509 | serverconfig_LandClaimSize_QueryName() {
|
---|
| 510 | echo "Land claim size"
|
---|
| 511 | }
|
---|
| 512 | serverconfig_LandClaimSize_Type() {
|
---|
| 513 | echo "number"
|
---|
| 514 | }
|
---|
| 515 | serverconfig_LandClaimSize_Default() {
|
---|
| 516 | echo "7"
|
---|
| 517 | }
|
---|
| 518 |
|
---|
| 519 |
|
---|
| 520 | serverconfig_LandClaimDeadZone_QueryName() {
|
---|
| 521 | echo "Minimum keystone distance"
|
---|
| 522 | }
|
---|
| 523 | serverconfig_LandClaimDeadZone_Type() {
|
---|
| 524 | echo "number"
|
---|
| 525 | }
|
---|
| 526 | serverconfig_LandClaimDeadZone_Default() {
|
---|
| 527 | echo "30"
|
---|
| 528 | }
|
---|
| 529 |
|
---|
| 530 |
|
---|
| 531 | serverconfig_LandClaimExpiryTime_QueryName() {
|
---|
| 532 | echo "Claim expiry time (days)"
|
---|
| 533 | }
|
---|
| 534 | serverconfig_LandClaimExpiryTime_Type() {
|
---|
| 535 | echo "number"
|
---|
| 536 | }
|
---|
| 537 | serverconfig_LandClaimExpiryTime_Default() {
|
---|
| 538 | echo "3"
|
---|
| 539 | }
|
---|
| 540 |
|
---|
| 541 |
|
---|
| 542 | serverconfig_LandClaimDecayMode_QueryName() {
|
---|
| 543 | echo "Claim decay mode"
|
---|
| 544 | }
|
---|
| 545 | serverconfig_LandClaimDecayMode_Type() {
|
---|
| 546 | echo "number"
|
---|
| 547 | }
|
---|
| 548 | serverconfig_LandClaimDecayMode_Default() {
|
---|
| 549 | echo "0"
|
---|
| 550 | }
|
---|
| 551 | serverconfig_LandClaimDecayMode_Range() {
|
---|
| 552 | echo "0-2"
|
---|
| 553 | }
|
---|
| 554 | serverconfig_LandClaimDecayMode_Values() {
|
---|
| 555 | config_allowed_values=("Linear" "Exponential" "Full protection")
|
---|
| 556 | }
|
---|
| 557 |
|
---|
| 558 |
|
---|
| 559 | serverconfig_LandClaimOnlineDurabilityModifier_QueryName() {
|
---|
| 560 | echo "Claim durability modifier - online"
|
---|
| 561 | }
|
---|
| 562 | serverconfig_LandClaimOnlineDurabilityModifier_Type() {
|
---|
| 563 | echo "number"
|
---|
| 564 | }
|
---|
| 565 | serverconfig_LandClaimOnlineDurabilityModifier_Default() {
|
---|
| 566 | echo "4"
|
---|
| 567 | }
|
---|
| 568 |
|
---|
| 569 |
|
---|
| 570 | serverconfig_LandClaimOfflineDurabilityModifier_QueryName() {
|
---|
| 571 | echo "Claim durability modifier - offline"
|
---|
| 572 | }
|
---|
| 573 | serverconfig_LandClaimOfflineDurabilityModifier_Type() {
|
---|
| 574 | echo "number"
|
---|
| 575 | }
|
---|
| 576 | serverconfig_LandClaimOfflineDurabilityModifier_Default() {
|
---|
| 577 | echo "4"
|
---|
| 578 | }
|
---|
| 579 |
|
---|
| 580 |
|
---|
| 581 |
|
---|
| 582 |
|
---|
| 583 | serverconfig_AirDropFrequency_QueryName() {
|
---|
| 584 | echo "Airdrop delay (hours)"
|
---|
| 585 | }
|
---|
| 586 | serverconfig_AirDropFrequency_Type() {
|
---|
| 587 | echo "number"
|
---|
| 588 | }
|
---|
| 589 | serverconfig_AirDropFrequency_Default() {
|
---|
[204] | 590 | echo "72"
|
---|
[19] | 591 | }
|
---|
| 592 |
|
---|
| 593 |
|
---|
[67] | 594 | serverconfig_MaxSpawnedZombies_QueryName() {
|
---|
| 595 | echo "Maximum number of concurrent zombies"
|
---|
| 596 | }
|
---|
| 597 | serverconfig_MaxSpawnedZombies_Type() {
|
---|
| 598 | echo "number"
|
---|
| 599 | }
|
---|
| 600 | serverconfig_MaxSpawnedZombies_Default() {
|
---|
| 601 | echo "60"
|
---|
| 602 | }
|
---|
[19] | 603 |
|
---|
| 604 |
|
---|
[204] | 605 | serverconfig_EACEnabled_QueryName() {
|
---|
| 606 | echo "Enable EasyAntiCheat"
|
---|
[67] | 607 | }
|
---|
[204] | 608 | serverconfig_EACEnabled_Type() {
|
---|
[67] | 609 | echo "boolean"
|
---|
| 610 | }
|
---|
[204] | 611 | serverconfig_EACEnabled_Default() {
|
---|
[67] | 612 | echo "true"
|
---|
| 613 | }
|
---|
[204] | 614 | serverconfig_EACEnabled_ErrorMessage() {
|
---|
[67] | 615 | echo "Not a valid boolean given (true/false or yes/no or y/n)."
|
---|
| 616 | }
|
---|
| 617 |
|
---|
| 618 |
|
---|
| 619 |
|
---|
| 620 |
|
---|
[23] | 621 | #################################
|
---|
| 622 | ## Edit option functions
|
---|
| 623 |
|
---|
| 624 | configEditServer() {
|
---|
| 625 | local CV
|
---|
| 626 |
|
---|
| 627 | echo "Server"
|
---|
| 628 | echo "--------------------------------"
|
---|
| 629 | for CV in \
|
---|
[204] | 630 | ServerName ServerPassword ServerIsPublic ServerPort ServerMaxPlayerCount ServerDescription ServerWebsiteURL \
|
---|
| 631 | DisableNAT EACEnabled MaxSpawnedZombies \
|
---|
[23] | 632 | ; do
|
---|
[24] | 633 | $1 $CV
|
---|
[23] | 634 | done
|
---|
| 635 | echo
|
---|
| 636 | }
|
---|
| 637 |
|
---|
| 638 | configEditRemoteControl() {
|
---|
| 639 | local CV
|
---|
| 640 |
|
---|
| 641 | echo "Remote control"
|
---|
| 642 | echo "--------------------------------"
|
---|
| 643 | for CV in \
|
---|
| 644 | ControlPanelEnabled ControlPanelPort ControlPanelPassword \
|
---|
| 645 | TelnetPort TelnetPassword \
|
---|
| 646 | ; do
|
---|
| 647 | if [ "$CV" = "TelnetPort" ]; then
|
---|
| 648 | echo
|
---|
| 649 | echo "NOTE: Telnet will always be enabled for management purposes!"
|
---|
[88] | 650 | echo "Make sure you block external access to this port or set no password"
|
---|
| 651 | echo "so the server will only listen on the loopback interface!"
|
---|
[23] | 652 | echo
|
---|
| 653 | fi
|
---|
[24] | 654 | $1 $CV
|
---|
[23] | 655 | done
|
---|
| 656 | echo
|
---|
| 657 | }
|
---|
| 658 |
|
---|
| 659 | configEditGameType() {
|
---|
| 660 | local CV
|
---|
| 661 |
|
---|
| 662 | echo "Game type"
|
---|
| 663 | echo "--------------------------------"
|
---|
| 664 | for CV in \
|
---|
| 665 | GameName GameWorld GameMode \
|
---|
| 666 | ; do
|
---|
[24] | 667 | $1 $CV
|
---|
[23] | 668 | done
|
---|
| 669 | echo
|
---|
| 670 | }
|
---|
| 671 |
|
---|
| 672 | configEditGeneric() {
|
---|
| 673 | local CV
|
---|
| 674 |
|
---|
| 675 | echo "Generic options"
|
---|
| 676 | echo "--------------------------------"
|
---|
| 677 | for CV in \
|
---|
[204] | 678 | FriendlyFire BuildCreate \
|
---|
[23] | 679 | BlockDurabilityModifier \
|
---|
| 680 | ; do
|
---|
[24] | 681 | $1 $CV
|
---|
[23] | 682 | done
|
---|
| 683 | echo
|
---|
| 684 | }
|
---|
| 685 |
|
---|
| 686 | configEditDropLoot() {
|
---|
| 687 | local CV
|
---|
| 688 |
|
---|
| 689 | echo "Drop and Loot"
|
---|
| 690 | echo "--------------------------------"
|
---|
| 691 | for CV in \
|
---|
| 692 | DropOnDeath DropOnQuit \
|
---|
| 693 | LootAbundance LootRespawnDays AirDropFrequency \
|
---|
| 694 | ; do
|
---|
[24] | 695 | $1 $CV
|
---|
[23] | 696 | done
|
---|
| 697 | echo
|
---|
| 698 | }
|
---|
| 699 |
|
---|
| 700 | configEditTimes() {
|
---|
| 701 | local CV
|
---|
| 702 |
|
---|
| 703 | echo "Times / Durations"
|
---|
| 704 | echo "--------------------------------"
|
---|
| 705 | for CV in \
|
---|
| 706 | CraftTimer LootTimer \
|
---|
| 707 | DayNightLength NightPercentage \
|
---|
| 708 | ; do
|
---|
[24] | 709 | $1 $CV
|
---|
[23] | 710 | done
|
---|
| 711 | echo
|
---|
| 712 | }
|
---|
| 713 |
|
---|
| 714 | configEditDifficulty() {
|
---|
| 715 | local CV
|
---|
| 716 |
|
---|
| 717 | echo "Difficulty"
|
---|
| 718 | echo "--------------------------------"
|
---|
| 719 | for CV in \
|
---|
| 720 | GameDifficulty ZombiesRun \
|
---|
[204] | 721 | EnemySenseMemory EnemySpawnMode EnemyDifficulty \
|
---|
[23] | 722 | ; do
|
---|
[24] | 723 | $1 $CV
|
---|
[23] | 724 | done
|
---|
| 725 | echo
|
---|
| 726 | }
|
---|
| 727 |
|
---|
| 728 | configEditLandClaim() {
|
---|
| 729 | local CV
|
---|
| 730 |
|
---|
| 731 | echo "Land claim options"
|
---|
| 732 | echo "--------------------------------"
|
---|
| 733 | for CV in \
|
---|
| 734 | LandClaimSize LandClaimDeadZone LandClaimExpiryTime LandClaimDecayMode \
|
---|
| 735 | LandClaimOnlineDurabilityModifier LandClaimOfflineDurabilityModifier \
|
---|
| 736 | ; do
|
---|
[24] | 737 | $1 $CV
|
---|
[23] | 738 | done
|
---|
| 739 | echo
|
---|
| 740 | }
|
---|
| 741 |
|
---|
| 742 | configEditAll() {
|
---|
[24] | 743 | configEditServer "$1"
|
---|
| 744 | configEditRemoteControl "$1"
|
---|
| 745 | configEditGameType "$1"
|
---|
| 746 | configEditGeneric "$1"
|
---|
| 747 | configEditDropLoot "$1"
|
---|
| 748 | configEditTimes "$1"
|
---|
| 749 | configEditDifficulty "$1"
|
---|
| 750 | configEditLandClaim "$1"
|
---|
[23] | 751 | }
|
---|
| 752 |
|
---|
| 753 |
|
---|
| 754 |
|
---|
| 755 |
|
---|
| 756 |
|
---|
| 757 | #################################
|
---|
| 758 | ## Generic worker functions
|
---|
| 759 |
|
---|
| 760 |
|
---|
| 761 | # List all defined config editing parts
|
---|
| 762 | # Returns:
|
---|
| 763 | # List of config funcs
|
---|
| 764 | listConfigEditFuncs() {
|
---|
| 765 | local CV
|
---|
| 766 | for CV in $(declare -F | cut -d\ -f3 | grep "^configEdit.*$"); do
|
---|
| 767 | CV=${CV#configEdit}
|
---|
| 768 | printf "%s " "$CV"
|
---|
| 769 | done
|
---|
| 770 | }
|
---|
| 771 |
|
---|
| 772 |
|
---|
| 773 | # List all defined config options
|
---|
| 774 | # Returns:
|
---|
| 775 | # List of defined config options
|
---|
[19] | 776 | listConfigValues() {
|
---|
| 777 | local CV
|
---|
| 778 | for CV in $(declare -F | cut -d\ -f3 | grep "^serverconfig_.*_Type$"); do
|
---|
| 779 | CV=${CV#serverconfig_}
|
---|
| 780 | CV=${CV%_Type}
|
---|
| 781 | printf "%s " "$CV"
|
---|
| 782 | done
|
---|
| 783 | }
|
---|
| 784 |
|
---|
| 785 |
|
---|
[23] | 786 | # Validate the given value for the given option
|
---|
| 787 | # Params:
|
---|
| 788 | # 1: Option name
|
---|
| 789 | # 2: Value
|
---|
| 790 | # Returns:
|
---|
| 791 | # 0/1: invalid/valid
|
---|
[19] | 792 | isValidOptionValue() {
|
---|
| 793 | local TYPE=$(serverconfig_$1_Type)
|
---|
| 794 | local RANGE=""
|
---|
| 795 |
|
---|
| 796 | if [ "$TYPE" = "enum" ]; then
|
---|
| 797 | TYPE="number"
|
---|
| 798 | serverconfig_$1_Values
|
---|
| 799 | RANGE=1-${#config_allowed_values[@]}
|
---|
| 800 | else
|
---|
| 801 | if [ "$(type -t serverconfig_$1_Range)" = "function" ]; then
|
---|
| 802 | RANGE=$(serverconfig_$1_Range)
|
---|
| 803 | fi
|
---|
| 804 | fi
|
---|
| 805 |
|
---|
| 806 | case "$TYPE" in
|
---|
| 807 | number)
|
---|
| 808 | if [ $(isANumber "$2") -eq 0 ]; then
|
---|
| 809 | echo "0"
|
---|
| 810 | return
|
---|
| 811 | fi
|
---|
| 812 | if [ ! -z "$RANGE" ]; then
|
---|
| 813 | local MIN=$(cut -d- -f1 <<< "$RANGE")
|
---|
| 814 | local MAX=$(cut -d- -f2 <<< "$RANGE")
|
---|
| 815 | if [ $2 -lt $MIN -o $2 -gt $MAX ]; then
|
---|
| 816 | echo "0"
|
---|
| 817 | return
|
---|
| 818 | fi
|
---|
| 819 | fi
|
---|
| 820 | ;;
|
---|
| 821 | boolean)
|
---|
| 822 | if [ $(isABool "$2") -eq 0 ]; then
|
---|
| 823 | echo "0"
|
---|
| 824 | return
|
---|
| 825 | fi
|
---|
| 826 | ;;
|
---|
| 827 | string)
|
---|
| 828 | ;;
|
---|
| 829 | esac
|
---|
| 830 |
|
---|
| 831 |
|
---|
| 832 | if [ "$(type -t serverconfig_$1_Validate)" = "function" ]; then
|
---|
| 833 | if [ $(serverconfig_$1_Validate "$2") -eq 0 ]; then
|
---|
| 834 | echo "0"
|
---|
| 835 | return
|
---|
| 836 | fi
|
---|
| 837 | fi
|
---|
| 838 |
|
---|
| 839 | echo "1"
|
---|
| 840 | }
|
---|
| 841 |
|
---|
[23] | 842 | # Query for the value of a single config option
|
---|
| 843 | # Will be stored in $configCurrent_$1
|
---|
| 844 | # Params:
|
---|
| 845 | # 1: Option name
|
---|
[19] | 846 | configQueryValue() {
|
---|
| 847 | local TYPE=$(serverconfig_$1_Type)
|
---|
| 848 | local NAME=""
|
---|
| 849 | local RANGE=""
|
---|
| 850 | local DEFAULT=""
|
---|
| 851 | local currentValName=configCurrent_$1
|
---|
| 852 |
|
---|
| 853 | if [ "$(type -t serverconfig_$1_Values)" = "function" ]; then
|
---|
| 854 | echo "$(serverconfig_$1_QueryName), options:"
|
---|
| 855 | serverconfig_$1_Values
|
---|
| 856 | NAME="Select option"
|
---|
| 857 | if [ "$TYPE" = "enum" ]; then
|
---|
| 858 | local OPTOFFSET=1
|
---|
| 859 | else
|
---|
| 860 | local OPTOFFSET=0
|
---|
| 861 | fi
|
---|
| 862 | for (( i=$OPTOFFSET; i < ${#config_allowed_values[@]}+$OPTOFFSET; i++ )); do
|
---|
| 863 | printf " %2d: %s\n" $i "${config_allowed_values[$i-$OPTOFFSET]}"
|
---|
| 864 | done
|
---|
| 865 | else
|
---|
| 866 | NAME=$(serverconfig_$1_QueryName)
|
---|
| 867 | fi
|
---|
| 868 |
|
---|
| 869 | if [ "$TYPE" = "enum" ]; then
|
---|
| 870 | RANGE=1-${#config_allowed_values[@]}
|
---|
| 871 | if [ ! -z "${!currentValName}" ]; then
|
---|
| 872 | for (( i=1; i < ${#config_allowed_values[@]}+1; i++ )); do
|
---|
| 873 | if [ "${!currentValName}" = "${config_allowed_values[$i-1]}" ]; then
|
---|
| 874 | DEFAULT=$i
|
---|
| 875 | fi
|
---|
| 876 | done
|
---|
| 877 | export $currentValName=
|
---|
| 878 | fi
|
---|
| 879 | else
|
---|
| 880 | if [ "$(type -t serverconfig_$1_Range)" = "function" ]; then
|
---|
| 881 | RANGE=$(serverconfig_$1_Range)
|
---|
| 882 | fi
|
---|
| 883 | fi
|
---|
| 884 |
|
---|
| 885 | if [ -z "$DEFAULT" ]; then
|
---|
| 886 | if [ ! -z "${!currentValName}" ]; then
|
---|
| 887 | DEFAULT=${!currentValName}
|
---|
| 888 | else
|
---|
| 889 | if [ "$(type -t serverconfig_$1_Default)" = "function" ]; then
|
---|
| 890 | DEFAULT=$(serverconfig_$1_Default)
|
---|
| 891 | fi
|
---|
| 892 | fi
|
---|
| 893 | fi
|
---|
| 894 |
|
---|
| 895 | local prompt=$(printf "%s" "$NAME")
|
---|
| 896 | if [ ! -z "$RANGE" ]; then
|
---|
| 897 | prompt=$(printf "%s (%s)" "$prompt" "$RANGE")
|
---|
| 898 | fi
|
---|
| 899 | if [ ! -z "$DEFAULT" ]; then
|
---|
| 900 | prompt=$(printf "%s [%s]" "$prompt" "$DEFAULT")
|
---|
| 901 | fi
|
---|
| 902 | prompt=$(printf "%s:" "$prompt")
|
---|
[24] | 903 | prompt=$(printf "%-*s " 40 "$prompt")
|
---|
[19] | 904 |
|
---|
| 905 | while : ; do
|
---|
| 906 | read -p "$prompt" $currentValName
|
---|
| 907 | export $currentValName="${!currentValName:-$DEFAULT}"
|
---|
| 908 | if [ $(isValidOptionValue "$1" "${!currentValName}") -eq 0 ]; then
|
---|
| 909 | if [ "$(type -t serverconfig_$1_ErrorMessage)" = "function" ]; then
|
---|
| 910 | serverconfig_$1_ErrorMessage "${!currentValName}"
|
---|
| 911 | fi
|
---|
| 912 | fi
|
---|
| 913 | [ $(isValidOptionValue "$1" "${!currentValName}") -eq 1 ] && break
|
---|
| 914 | done
|
---|
| 915 |
|
---|
[45] | 916 | if [ "$TYPE" = "boolean" ]; then
|
---|
| 917 | if [ $(getBool ${!currentValName}) -eq 1 ]; then
|
---|
| 918 | export $currentValName="true"
|
---|
| 919 | else
|
---|
| 920 | export $currentValName="false"
|
---|
| 921 | fi
|
---|
| 922 | fi
|
---|
[19] | 923 | if [ "$TYPE" = "enum" ]; then
|
---|
| 924 | export $currentValName="${config_allowed_values[$currentValName-1]}"
|
---|
| 925 | fi
|
---|
[24] | 926 | echo
|
---|
[19] | 927 | }
|
---|
| 928 |
|
---|
[23] | 929 | # Set parameters for current instance that have forced values:
|
---|
| 930 | # - TelnetEnabled must be set so that management scripts can work
|
---|
| 931 | # - AdminFileName is made to point to the local instance admins.xml
|
---|
| 932 | # - SaveGameFolder is made to point to the instance folder
|
---|
| 933 | # Params:
|
---|
[19] | 934 | # 1: Instance name
|
---|
| 935 | configSetAutoParameters() {
|
---|
| 936 | configCurrent_TelnetEnabled=true
|
---|
| 937 | configCurrent_AdminFileName=admins.xml
|
---|
[35] | 938 | configCurrent_SaveGameFolder="$(getInstancePath "$1")"
|
---|
[19] | 939 | }
|
---|
| 940 |
|
---|
| 941 |
|
---|
[24] | 942 | # Print defined config value
|
---|
| 943 | # Params:
|
---|
| 944 | # 1: Config option
|
---|
| 945 | printConfigValue() {
|
---|
| 946 | local currentValName=configCurrent_$1
|
---|
| 947 | printf "%-25s = %s\n" "$(serverconfig_$1_QueryName)" "${!currentValName}"
|
---|
[19] | 948 | }
|
---|
| 949 |
|
---|
[23] | 950 | # Query for an instance name (will be saved in $INSTANCE)
|
---|
[19] | 951 | readInstanceName() {
|
---|
| 952 | until [ $(isValidInstanceName "$INSTANCE") -eq 1 ]; do
|
---|
| 953 | read -p "Instance name: " INSTANCE
|
---|
| 954 | if [ $(isValidInstanceName "$INSTANCE") -eq 0 ]; then
|
---|
| 955 | echo "Invalid instance name, may only contain:"
|
---|
| 956 | echo " - letters (A-Z / a-z)"
|
---|
| 957 | echo " - digits (0-9)"
|
---|
| 958 | echo " - underscores (_)"
|
---|
| 959 | echo " - hyphens (-)"
|
---|
| 960 | fi
|
---|
| 961 | done
|
---|
| 962 | }
|
---|
| 963 |
|
---|
[23] | 964 | # Undefine the current config values
|
---|
[19] | 965 | unsetAllConfigValues() {
|
---|
| 966 | local CV
|
---|
| 967 | for CV in $(listConfigValues); do
|
---|
| 968 | local currentValName=configCurrent_$CV
|
---|
| 969 | export $currentValName=
|
---|
| 970 | done
|
---|
| 971 | }
|
---|
| 972 |
|
---|
[23] | 973 | # Load all config values from the config.xml of the given instance
|
---|
| 974 | # Params:
|
---|
[19] | 975 | # 1: Instance name
|
---|
| 976 | loadCurrentConfigValues() {
|
---|
| 977 | local CV
|
---|
| 978 | for CV in $(listConfigValues); do
|
---|
| 979 | local currentValName=configCurrent_$CV
|
---|
| 980 | local cfile=$(getInstancePath "$1")/config.xml
|
---|
| 981 | local XPATH="/ServerSettings/property[@name='$CV']/@value"
|
---|
| 982 | local VAL=$($XMLSTARLET sel -t -v "$XPATH" $cfile)
|
---|
| 983 | if [ ! -z "$VAL" ]; then
|
---|
| 984 | export $currentValName="$VAL"
|
---|
| 985 | fi
|
---|
| 986 | done
|
---|
| 987 | }
|
---|
| 988 |
|
---|
[23] | 989 | # Save all config values to the config.xml of the given instance
|
---|
| 990 | # Params:
|
---|
[19] | 991 | # 1: Instance name
|
---|
| 992 | saveCurrentConfigValues() {
|
---|
| 993 | local CV
|
---|
| 994 | for CV in $(listConfigValues) TelnetEnabled AdminFileName SaveGameFolder; do
|
---|
| 995 | local currentValName=configCurrent_$CV
|
---|
| 996 | local val="${!currentValName}"
|
---|
| 997 | local cfile=$(getInstancePath "$1")/config.xml
|
---|
| 998 |
|
---|
| 999 | XPATHBASE="/ServerSettings/property[@name='$CV']"
|
---|
| 1000 |
|
---|
| 1001 | if [ -z $($XMLSTARLET sel -t -v "$XPATHBASE/@name" $cfile) ]; then
|
---|
| 1002 | $XMLSTARLET ed -L \
|
---|
| 1003 | -s "/ServerSettings" -t elem -n "property" -v "" \
|
---|
| 1004 | -i "/ServerSettings/property[not(@name)]" -t attr -n "name" -v "$CV" \
|
---|
| 1005 | -i "$XPATHBASE" -t attr -n "value" -v "$val" \
|
---|
| 1006 | $cfile
|
---|
| 1007 | else
|
---|
| 1008 | $XMLSTARLET ed -L \
|
---|
| 1009 | -u "$XPATHBASE/@value" -v "$val" \
|
---|
| 1010 | $cfile
|
---|
| 1011 | fi
|
---|
| 1012 | done
|
---|
| 1013 | }
|
---|
| 1014 |
|
---|
[23] | 1015 | # Check if the config template exists
|
---|
| 1016 | # Returns:
|
---|
| 1017 | # 0/1: no/yes
|
---|
[19] | 1018 | configTemplateExists() {
|
---|
| 1019 | if [ -f $SDTD_BASE/templates/config.xml ]; then
|
---|
| 1020 | echo 1
|
---|
| 1021 | else
|
---|
| 1022 | echo 0
|
---|
| 1023 | fi
|
---|
| 1024 | }
|
---|
| 1025 |
|
---|
| 1026 | # Get a single value from a serverconfig
|
---|
| 1027 | # Params:
|
---|
| 1028 | # 1: Instance name
|
---|
| 1029 | # 2: Property name
|
---|
| 1030 | # Returns:
|
---|
| 1031 | # Property value
|
---|
| 1032 | getConfigValue() {
|
---|
| 1033 | local CONF=$(getInstancePath $1)/config.xml
|
---|
| 1034 | $XMLSTARLET sel -t -v "/ServerSettings/property[@name='$2']/@value" $CONF
|
---|
| 1035 | }
|
---|
| 1036 |
|
---|
| 1037 | # Update a single value in a serverconfig
|
---|
| 1038 | # Params:
|
---|
| 1039 | # 1: Instance name
|
---|
| 1040 | # 2: Property name
|
---|
| 1041 | # 3: New value
|
---|
| 1042 | setConfigValue() {
|
---|
| 1043 | local CONF=$(getInstancePath $1)/config.xml
|
---|
| 1044 | $XMLSTARLET ed -L -u "/ServerSettings/property[@name='$2']/@value" -v "$3" $CONF
|
---|
| 1045 | }
|
---|
| 1046 |
|
---|