diff --git a/scripts/Common/Software/docker/services/trackmania/xaseco-entrypoint.sh b/scripts/Common/Software/docker/services/trackmania/xaseco-entrypoint.sh index a3b6732c..bc29ed94 100755 --- a/scripts/Common/Software/docker/services/trackmania/xaseco-entrypoint.sh +++ b/scripts/Common/Software/docker/services/trackmania/xaseco-entrypoint.sh @@ -12,6 +12,7 @@ data="/data" runDir="/opt/xaseco" entrypoint="$cache/aseco.php" config="$runDir/config.xml" +adminConfig="$runDir/adminops.xml" dbConfig="$runDir/localdatabase.xml" dediConfig="$runDir/dedimania.xml" pluginConfig="$runDir/plugins.xml" @@ -20,6 +21,8 @@ serverPath="$settingsPath/tmserver" pluginTag="plugin" pluginPath="/aseco_plugins" +userPattern="^(.+?)(@([[:digit:]]+(.[[:digit:]]+){3}))?\$" + tmOptions=( TM_SERVER_HOST ip TM_SERVER_PORT port @@ -28,6 +31,11 @@ tmOptions=( TM_TIMEOUT timeout ) +groups=( + ADMINS admins + OPERATORS operators +) + sqlOptions=( MYSQL_HOST mysql_server MYSQL_USER mysql_login @@ -114,6 +122,23 @@ for i in $(seq 0 2 $((${#tmOptions[@]} - 1))); do fi done +for i in $(seq 0 2 $((${#groups[@]} - 1))); do + var="${groups[$i]}" + group="${groups[$(($i + 1))]}" + value="${!var}" + path="/lists/$group" + + echo "$value" | while read user; do + name="$(echo "$user" | LC_ALL="C" perl -pe "s/$userPattern/\1/")" + ip="$(echo "$user" | LC_ALL="C" perl -pe "s/$userPattern/\3/")" + xmlstarlet edit --inplace --subnode "$path" --type elem -n "tmlogin" --value "$name" "$adminConfig" + + if [ -n "$ip" ]; then + xmlstarlet edit --inplace --subnode "$path" --type elem -n "ipaddress" --value "$ip" "$adminConfig" + fi + done +done + for i in $(seq 0 2 $((${#sqlOptions[@]} - 1))); do var="${sqlOptions[$i]}" option="${sqlOptions[$(($i + 1))]}" diff --git a/scripts/Common/Software/docker/services/trackmania/xaseco.Dockerfile b/scripts/Common/Software/docker/services/trackmania/xaseco.Dockerfile index ce0da656..d72bc112 100644 --- a/scripts/Common/Software/docker/services/trackmania/xaseco.Dockerfile +++ b/scripts/Common/Software/docker/services/trackmania/xaseco.Dockerfile @@ -11,7 +11,8 @@ RUN apk update \ # xmlstarlet dependencies musl \ libxslt \ - libxml2 + libxml2 \ + perl RUN update-ca-certificates RUN docker-php-ext-install mysql COPY --from=base /usr/bin/xmlstarlet /usr/bin @@ -29,6 +30,9 @@ ENV \ MASTERADMIN_USER="" \ MASTERADMIN_IP="" \ \ + ADMINS="" \ + OPERATORS="" \ + \ X1_EXTRA_PLUGINS="" \ X1_DISABLED_PLUGINS="" \ \