eliminate CR LF when parsing blacklist.txt

grep cannot handle CRLF by itself
This commit is contained in:
fanyx 2024-10-14 01:23:07 +02:00
parent a8492ad00b
commit 7ea63f5a55
4 changed files with 27 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

@ -208,11 +208,11 @@ 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,11 @@ 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 ]] && \ [[ -r ./blacklist.txt ]] && {
PLUGINS_LIST=($(echo ${PLUGINS_LIST[@]} | tr ' ' '\n' | grep -vFf blacklist)) BLACKLIST=($(cat ./blacklist.txt | tr '\r' ' ' | tr '\n' ' '))
PLUGINS_LIST=($(echo "${PLUGINS_LIST[@]}" | tr ' ' '\n' |\
grep -vf <(echo "${BLACKLIST[@]}" | tr ' ' '\n')))
}
{ {
# open with header -- \n interpreted # open with header -- \n interpreted