[WIP] add config parameter to start.sh

This commit is contained in:
Leonard Steppy 2025-12-24 23:24:44 +01:00
parent 61cb39b414
commit 3e0ace43d2
2 changed files with 14 additions and 5 deletions

View File

@ -56,7 +56,6 @@ function main {
;; ;;
"--fetch") "--fetch")
fetch=true fetch=true
quiet=true
;; ;;
"--quiet" | "-q") "--quiet" | "-q")
quiet=true quiet=true
@ -89,6 +88,7 @@ function main {
# fetch current configuration # fetch current configuration
if $fetch; then if $fetch; then
quiet=true
if [ "$(yq '.proxies.velocity.enabled // false' config/paper-global.yml)" = "true" ]; then if [ "$(yq '.proxies.velocity.enabled // false' config/paper-global.yml)" = "true" ]; then
echo "velocity" echo "velocity"
elif [ "$(yq '.settings.bungeecord // false' spigot.yml)" = "true" ]; then elif [ "$(yq '.settings.bungeecord // false' spigot.yml)" = "true" ]; then

View File

@ -10,12 +10,18 @@ function main {
local bungee=false local bungee=false
local help=false local help=false
local sleep_seconds=$DEFAULT_SLEEP_SECONDS local sleep_seconds=$DEFAULT_SLEEP_SECONDS
local config=""
local cmd=$0 local cmd=$0
# TODO --config is incompatible with --proxy, --bungee and standalone
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
local arg=$1 local arg=$1
case "$arg" in case "$arg" in
"--config" | "-c")
config=$2 #TODO ensure mode is valid
shift 2
;;
"--sleep" | "-s") "--sleep" | "-s")
sleep_seconds=$2 sleep_seconds=$2
shift 2 shift 2
@ -50,13 +56,16 @@ function main {
echo "Usage $cmd [OPTIONS]" echo "Usage $cmd [OPTIONS]"
echo "" echo ""
echo "OPTIONS:" echo "OPTIONS:"
echo " -s --sleep How many seconds to sleep after the server has stopped before starting it again" echo " -c --config <mode> How to configure the server. Possible values for mode are: proxy, bungee, standalone"
echo " -h --help Show help" echo " -s --sleep <secs> How many seconds to sleep after the server has stopped before starting it again"
echo " --proxy Start the server behind a velocity proxy" echo " -h --help Show help"
echo " --bungee Start the server behind a bungeecord proxy" echo " --proxy Start the server behind a velocity proxy"
echo " --bungee Start the server behind a bungeecord proxy"
exit exit
fi fi
# TODO perform configuration according to config parameter
if $proxy; then if $proxy; then
./configure.sh velocity ./configure.sh velocity