From 3a91f1bd9a1e755951d7e6b0b8d310a36d26db45 Mon Sep 17 00:00:00 2001 From: Dave Fallon Date: Sun, 9 Jun 2013 22:12:42 -0700 Subject: [PATCH] Fixes marcuswhybrow/minecraft-server-manager#163 --- init/msm | 10 ++++++++++ msm.conf | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/init/msm b/init/msm index 47241546..50aacb96 100755 --- a/init/msm +++ b/init/msm @@ -1217,6 +1217,7 @@ server_create() { manager_property DEFAULT_BANNED_IPS_PATH manager_property DEFAULT_BANNED_PLAYERS_PATH manager_property DEFAULT_OPS_PATH + manager_property DEFAULT_OPS_LIST manager_property SERVER_PROPERTIES manager_property DEFAULT_WORLD_STORAGE_PATH manager_property JAR_STORAGE_PATH @@ -1230,6 +1231,14 @@ server_create() { as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_BANNED_IPS_PATH'" as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_BANNED_PLAYERS_PATH'" as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_OPS_PATH'" + + # Set default ops users as appropriate + if [ ! -z "$SETTINGS_DEFAULT_OPS_LIST" ]; then + IFS=","; for default_ops_user in $SETTINGS_DEFAULT_OPS_LIST; do + as_user "$SETTINGS_USERNAME" "echo $default_ops_user | tr -d ' ' >> '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_OPS_PATH'" + done + fi + as_user "$SETTINGS_USERNAME" "touch '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_SERVER_PROPERTIES'" as_user "$SETTINGS_USERNAME" "mkdir -p '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_WORLD_STORAGE_PATH'" as_user "$SETTINGS_USERNAME" "echo \"MSM requires all your worlds be moved into this directory.\" > '$SETTINGS_SERVER_STORAGE_PATH/$1/$SETTINGS_DEFAULT_WORLD_STORAGE_PATH/readme.txt'" @@ -3196,6 +3205,7 @@ register_settings() { register_server_setting BANNED_PLAYERS_PATH "banned-players.txt" register_server_setting BANNED_IPS_PATH "banned-ips.txt" register_server_setting OPS_PATH "ops.txt" + register_server_setting OPS_LIST "" register_server_setting JAR_PATH "server.jar" register_server_setting FLAG_ACTIVE_PATH "active" diff --git a/msm.conf b/msm.conf index 621630b7..20bd7684 100644 --- a/msm.conf +++ b/msm.conf @@ -107,6 +107,10 @@ DEFAULT_BANNED_PLAYERS_PATH="banned-players.txt" DEFAULT_BANNED_IPS_PATH="banned-ips.txt" DEFAULT_OPS_PATH="ops.txt" +# List of comma-separated users that are added by default to ops.txt on server +# creation. +DEFAULT_OPS_LIST="" + # The location of the jar file to execute, relative to the server directory DEFAULT_JAR_PATH="server.jar"