#8: Force dos2unix on blacklist.txt

grep cannot deal with CRLF line endings
This commit is contained in:
fanyx 2024-10-14 01:23:07 +02:00
parent a8492ad00b
commit b430e7975f
4 changed files with 29 additions and 24 deletions

View File

@ -1,7 +1,7 @@
FROM php:5.6-alpine 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 RUN docker-php-ext-install mysql
COPY tmserver/ /var/lib/tmserver COPY tmserver/ /var/lib/tmserver

View File

@ -11,7 +11,7 @@ bundled with XAseco.
### docker-compose ### 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, with a possible setup. Adjust it to your needs and according to the documentation below,
then run then run
@ -29,15 +29,15 @@ then run
### Optional ### Optional
``` ```
- SERVER_SA_PASSWORD | Password for SuperAdmin credential - SERVER_SA_PASSWORD | Password for SuperAdmin credential
-> when left empty will be randomly generated -> 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 -> when left empty will be randomly generated
- SERVER_PORT | Port for server communications -> Default : 2350 - SERVER_PORT | Port for server communications -> Default : 2350
- SERVER_P2P_PORT | Port for peer2peer communication -> Default : 3450 - SERVER_P2P_PORT | Port for peer2peer communication -> Default : 3450
- SERVER_NAME | Server name in ingame browser -> Default : "Trackmania Server" - SERVER_NAME | Server name in ingame browser -> Default : "Trackmania Server"
- SERVER_COMMENT | Server description -> Default : "This is a 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 unwanted logins, set a server password
- HIDE_SERVER | Whether you want your server public or not -> Default : 0 (public) - HIDE_SERVER | Whether you want your server public or not -> Default : 0 (public)
- MAX_PLAYERS | Max player count -> Default : 32 - MAX_PLAYERS | Max player count -> Default : 32
@ -92,8 +92,8 @@ then run
## Configuration - XAseco ## Configuration - XAseco
I've taken the freedom to ease the MySQL configuration a bit. I've taken the freedom to ease the MySQL configuration a bit.
Other plugins still need to be configured fully. Other plugins still need to be configured fully.
Acquire the necessary files and follow the guide to custom configurations below. Acquire the necessary files and follow the guide to custom configurations below.
### Mandatory ### 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_HOST | Host of MySQL database -> Default : db
- MYSQL_LOGIN | Username of MySQL database -> Default : trackmania - MYSQL_LOGIN | Username of MySQL database -> Default : trackmania
- MYSQL_PASSWORD (Mandatory) | Password of MySQL user - MYSQL_PASSWORD (Mandatory) | Password of MySQL user
- MYSQL_DATABASE | Name of MySQL database -> Default : trackmania - MYSQL_DATABASE | Name of MySQL database -> Default : trackmania
``` ```
## Customization ## Customization
@ -133,11 +133,11 @@ in the `tracks/` folder and mounting it to `/var/lib/tmserver/GameData/Tracks/Cu
### Custom Playlist ### 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`. 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. 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` 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. by its relative path to the `Tracks` folder.
@ -194,25 +194,25 @@ like RemoteCP.
### Custom configuration files ### Custom configuration files
Most plugins need you to provide valid configuration files to function in the first place. 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/`. 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. All files will be linked to XAseco's root folder.
Careful, this will overwrite exisiting default files and `localdatabase.xml` as well. Careful, this will overwrite exisiting default files and `localdatabase.xml` as well.
### Custom plugins ### Custom plugins
Custom plugins work similar to configuration files. Custom plugins work similar to configuration files.
Create a folder like `plugins/` and mount it to `/var/lib/xaseco/plugins/custom/`. Create a folder like `plugins/` and mount it to `/var/lib/xaseco/plugins/custom/`.
They will be linked down to the plugins folder. They will be linked down to the plugins folder.
### Plugin blacklist ### Plugin blacklist
Create a file called `blacklist` and list plugins by filename that you want ignored on Create a file called `blacklist.txt` and list plugins by filename that you want ignored on
XAseco's boot. XAseco's boot.
Mount this file at `/var/lib/xaseco/blacklist`. Mount this file at `/var/lib/xaseco/blacklist.txt`.
blacklist: blacklist.txt:
``` ```
jfreu.chat.php jfreu.chat.php
jfreu.plugin.php jfreu.plugin.php

View File

@ -1,6 +1,6 @@
services: services:
tmserver: tmserver:
image: fanyx/tmserver:2.2.0 image: fanyx/tmserver:2.2.1
container_name: trackmania_tmserver container_name: trackmania_tmserver
depends_on: depends_on:
- db - db
@ -9,7 +9,7 @@ services:
volumes: volumes:
- ./tracks:/var/lib/tmserver/GameData/Tracks/Challenges/Custom # => Custom tracks - ./tracks:/var/lib/tmserver/GameData/Tracks/Challenges/Custom # => Custom tracks
- ./playlist.txt:/var/lib/tmserver/playlist.txt # => Custom playlist - ./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 - ./plugins:/var/lib/xaseco/plugins/custom # => Custom plugins
- ./config:/var/lib/xaseco/config # => Custom configuration files - ./config:/var/lib/xaseco/config # => Custom configuration files
ports: ports:

View File

@ -14,8 +14,13 @@ fi
PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g')) PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g'))
[[ -r ./blacklist ]] && \ [[ -w ./blacklist.txt ]] && dos2unix ./blacklist || {
PLUGINS_LIST=($(echo ${PLUGINS_LIST[@]} | tr ' ' '\n' | grep -vFf 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 # open with header -- \n interpreted
@ -30,7 +35,7 @@ PLUGINS_LIST=($(ls -d plugins/*.php | sed -e 's/plugins\///g'))
"plugin.localdatabase.php") "plugin.localdatabase.php")
;; ;;
"plugin.records_eyepiece.php") "plugin.records_eyepiece.php")
;; ;;
*) *)
printf " <plugin>%s</plugin>\n" "${plugin}" printf " <plugin>%s</plugin>\n" "${plugin}"
;; ;;