From b430e7975f82a254f3e214d1053e9a2e18da5a1e Mon Sep 17 00:00:00 2001 From: fanyx Date: Mon, 14 Oct 2024 01:23:07 +0200 Subject: [PATCH] #8: Force dos2unix on blacklist.txt grep cannot deal with CRLF line endings --- Dockerfile | 4 ++-- README.md | 34 +++++++++++++++++----------------- docker-compose.yml | 4 ++-- xaseco/bin/plugins.sh | 11 ++++++++--- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 334d726..f4e3ea1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM php:5.6-alpine -ARG S6_OVERLAY_VERSION=3.1.1.1 +ARG S6_OVERLAY_VERSION=3.2.0.2 -RUN apk add --no-cache pwgen gettext xmlstarlet bash xz +RUN apk add --no-cache pwgen gettext xmlstarlet bash xz dos2unix RUN docker-php-ext-install mysql COPY tmserver/ /var/lib/tmserver diff --git a/README.md b/README.md index c8765b6..9960598 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ bundled with XAseco. ### docker-compose -Check the default [`docker-compose.yml`](./docker-compose.yml) to familiarize yourself +Check the default [`docker-compose.yml`](./docker-compose.yml) to familiarize yourself with a possible setup. Adjust it to your needs and according to the documentation below, then run @@ -29,15 +29,15 @@ then run ### Optional ``` - - SERVER_SA_PASSWORD | Password for SuperAdmin credential + - SERVER_SA_PASSWORD | Password for SuperAdmin credential -> when left empty will be randomly generated - - SERVER_ADM_PASSWORD | Password for Admin credential + - SERVER_ADM_PASSWORD | Password for Admin credential -> when left empty will be randomly generated - SERVER_PORT | Port for server communications -> Default : 2350 - SERVER_P2P_PORT | Port for peer2peer communication -> Default : 3450 - SERVER_NAME | Server name in ingame browser -> Default : "Trackmania Server" - SERVER_COMMENT | Server description -> Default : "This is a Trackmania Server" - - SERVER_PASSWORD | If you want to secure your server against + - SERVER_PASSWORD | If you want to secure your server against unwanted logins, set a server password - HIDE_SERVER | Whether you want your server public or not -> Default : 0 (public) - MAX_PLAYERS | Max player count -> Default : 32 @@ -92,8 +92,8 @@ then run ## Configuration - XAseco -I've taken the freedom to ease the MySQL configuration a bit. -Other plugins still need to be configured fully. +I've taken the freedom to ease the MySQL configuration a bit. +Other plugins still need to be configured fully. Acquire the necessary files and follow the guide to custom configurations below. ### Mandatory @@ -108,7 +108,7 @@ Acquire the necessary files and follow the guide to custom configurations below. - MYSQL_HOST | Host of MySQL database -> Default : db - MYSQL_LOGIN | Username of MySQL database -> Default : trackmania - MYSQL_PASSWORD (Mandatory) | Password of MySQL user - - MYSQL_DATABASE | Name of MySQL database -> Default : trackmania + - MYSQL_DATABASE | Name of MySQL database -> Default : trackmania ``` ## Customization @@ -133,11 +133,11 @@ in the `tracks/` folder and mounting it to `/var/lib/tmserver/GameData/Tracks/Cu ### Custom Playlist -You can add tracks to a playlist in a simple way. +You can add tracks to a playlist in a simple way. Create a plaintext file like in the example below and mount it to `/var/lib/tmserver/playlist.txt`. To enable parsing of this file set `CUSTOM_PLAYLIST` in your env-file to anything but an empty string. -The tracks for the server are stored relative to `/var/lib/tmserver/GameData/Tracks`. +The tracks for the server are stored relative to `/var/lib/tmserver/GameData/Tracks`. Creating your own playlist is as easy as specifying each track on a separate line in the `playlist.txt` by its relative path to the `Tracks` folder. @@ -194,25 +194,25 @@ like RemoteCP. ### Custom configuration files -Most plugins need you to provide valid configuration files to function in the first place. -Place these in a folder e.g. `config/` and mount it to `/var/lib/xaseco/config/`. +Most plugins need you to provide valid configuration files to function in the first place. +Place these in a folder e.g. `config/` and mount it to `/var/lib/xaseco/config/`. All files will be linked to XAseco's root folder. Careful, this will overwrite exisiting default files and `localdatabase.xml` as well. ### Custom plugins -Custom plugins work similar to configuration files. -Create a folder like `plugins/` and mount it to `/var/lib/xaseco/plugins/custom/`. +Custom plugins work similar to configuration files. +Create a folder like `plugins/` and mount it to `/var/lib/xaseco/plugins/custom/`. They will be linked down to the plugins folder. ### Plugin blacklist -Create a file called `blacklist` and list plugins by filename that you want ignored on -XAseco's boot. -Mount this file at `/var/lib/xaseco/blacklist`. +Create a file called `blacklist.txt` and list plugins by filename that you want ignored on +XAseco's boot. +Mount this file at `/var/lib/xaseco/blacklist.txt`. -blacklist: +blacklist.txt: ``` jfreu.chat.php jfreu.plugin.php diff --git a/docker-compose.yml b/docker-compose.yml index e8f1fa7..b3a47ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: tmserver: - image: fanyx/tmserver:2.2.0 + image: fanyx/tmserver:2.2.1 container_name: trackmania_tmserver depends_on: - db @@ -9,7 +9,7 @@ services: volumes: - ./tracks:/var/lib/tmserver/GameData/Tracks/Challenges/Custom # => Custom tracks - ./playlist.txt:/var/lib/tmserver/playlist.txt # => Custom playlist - - ./blacklist:/var/lib/xaseco/blacklist # => Plugin blacklist + - ./blacklist.txt:/var/lib/xaseco/blacklist.txt # => Plugin blacklis1 - ./plugins:/var/lib/xaseco/plugins/custom # => Custom plugins - ./config:/var/lib/xaseco/config # => Custom configuration files ports: diff --git a/xaseco/bin/plugins.sh b/xaseco/bin/plugins.sh index 86fe1b5..d171571 100755 --- a/xaseco/bin/plugins.sh +++ b/xaseco/bin/plugins.sh @@ -14,8 +14,13 @@ fi PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g')) -[[ -r ./blacklist ]] && \ - PLUGINS_LIST=($(echo ${PLUGINS_LIST[@]} | tr ' ' '\n' | grep -vFf blacklist)) +[[ -w ./blacklist.txt ]] && dos2unix ./blacklist || { + echo "Can't convert blacklist to Unix line breaks. Check file permissions..." + exit 1 +} + +[[ -r ./blacklist.txt ]] && \ + PLUGINS_LIST=($(echo ${PLUGINS_LIST[@]} | tr ' ' '\n' | grep -vf blacklist)) { # open with header -- \n interpreted @@ -30,7 +35,7 @@ PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g')) "plugin.localdatabase.php") ;; "plugin.records_eyepiece.php") - ;; + ;; *) printf " %s\n" "${plugin}" ;;