From 895c9bb2696ef03cfb3929ac9a762d937d887ecd Mon Sep 17 00:00:00 2001 From: Bocki Date: Fri, 30 Apr 2021 16:13:35 +0200 Subject: [PATCH 1/6] [Config] Add custom config location --- Dockerfile | 4 +++- start-rssbridge | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 start-rssbridge diff --git a/Dockerfile b/Dockerfile index 4b844541d58..098d0b11f2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,6 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ && sed -ri -e 's/(MinProtocol\s*=\s*)TLSv1\.2/\1None/' /etc/ssl/openssl.cnf \ && sed -ri -e 's/(CipherString\s*=\s*DEFAULT)@SECLEVEL=2/\1/' /etc/ssl/openssl.cnf -COPY --chown=www-data:www-data ./ /app/ \ No newline at end of file +COPY --chown=www-data:www-data ./ /app/ + +CMD ["/app/start-rssbridge"] \ No newline at end of file diff --git a/start-rssbridge b/start-rssbridge new file mode 100644 index 00000000000..0165fdcb132 --- /dev/null +++ b/start-rssbridge @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Find custom files in the /config folder and copy them to the respective folders in /app. +# Look for bridges that end in 'Bridge.php' and for the whitelist and config.ini files. Everything else is ignored +# This will overwrite previous configs and bridges. It also uses the default paths of the configs and bridges, so if there is no file that matches, rss-bridge works like default. +for f in `find /config/ -type f`; do + fname=${f##*/} + case $fname in + *Bridge.php) yes | cp $f /app/bridges/ ; + chown www-data:www-data /app/bridges/$fname; + printf "Custom Bridge %s added.\n" $fname;; + config.ini.php) yes | cp $f /app/ ; + chown www-data:www-data /app/$fname; + printf "Custom config.ini.php added.\n";; + whitelist.txt) yes | cp $f /app/ ; + chown www-data:www-data /app/$fname; + printf "Custom whitelist.txt added.\n";; + esac +done + +# Start apache +apache2-foreground \ No newline at end of file From 4954d0573b43a64b47208b6c99c6c4bb140f7d45 Mon Sep 17 00:00:00 2001 From: Henning Bocklage Date: Sat, 1 May 2021 21:32:51 +0200 Subject: [PATCH 2/6] [Config] Rename, readability, check for spaces --- Dockerfile | 2 +- docker-entrypoint.sh | 27 +++++++++++++++++++++++++++ start-rssbridge | 22 ---------------------- 3 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 docker-entrypoint.sh delete mode 100644 start-rssbridge diff --git a/Dockerfile b/Dockerfile index 098d0b11f2f..b25aeb6b683 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,4 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ COPY --chown=www-data:www-data ./ /app/ -CMD ["/app/start-rssbridge"] \ No newline at end of file +CMD ["/app/docker-entrypoint.sh"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 00000000000..7931612a3fb --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Find custom files in the /config folder and copy them to the respective folders in /app. +# Look for bridges that end in 'Bridge.php' and for the whitelist and config.ini files. Everything else is ignored +# This will overwrite previous configs and bridges. It also uses the default paths of the configs and bridges, so if there is no file that matches, rss-bridge works like default. + +for file in `find /config/ -type f`; do + file_name="$(basename "$file")" # Strip leading path + if [[ $file_name= *" "* ]]; then + printf 'Custom Bridge %s has a space in the name and will be skipped.\n' "$file_name" + break + fi + case "$file_name" in + *Bridge.php) yes | cp "$file" /app/bridges/ ; + chown www-data:www-data /app/bridges/$file_name; + printf "Custom Bridge %s added.\n" $file_name;; + config.ini.php) yes | cp "$file" /app/ ; + chown www-data:www-data /app/$file_name; + printf "Custom config.ini.php added.\n";; + whitelist.txt) yes | cp "$file" /app/ ; + chown www-data:www-data /app/$file_name; + printf "Custom whitelist.txt added.\n";; + esac +done + +# Start apache +apache2-foreground diff --git a/start-rssbridge b/start-rssbridge deleted file mode 100644 index 0165fdcb132..00000000000 --- a/start-rssbridge +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -# Find custom files in the /config folder and copy them to the respective folders in /app. -# Look for bridges that end in 'Bridge.php' and for the whitelist and config.ini files. Everything else is ignored -# This will overwrite previous configs and bridges. It also uses the default paths of the configs and bridges, so if there is no file that matches, rss-bridge works like default. -for f in `find /config/ -type f`; do - fname=${f##*/} - case $fname in - *Bridge.php) yes | cp $f /app/bridges/ ; - chown www-data:www-data /app/bridges/$fname; - printf "Custom Bridge %s added.\n" $fname;; - config.ini.php) yes | cp $f /app/ ; - chown www-data:www-data /app/$fname; - printf "Custom config.ini.php added.\n";; - whitelist.txt) yes | cp $f /app/ ; - chown www-data:www-data /app/$fname; - printf "Custom whitelist.txt added.\n";; - esac -done - -# Start apache -apache2-foreground \ No newline at end of file From 11fc97c81860918e3b96629ee889c18071791bc6 Mon Sep 17 00:00:00 2001 From: Henning Bocklage Date: Sat, 1 May 2021 21:36:38 +0200 Subject: [PATCH 3/6] [Config] Also quote the chown command --- docker-entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7931612a3fb..07c25549901 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -12,13 +12,13 @@ for file in `find /config/ -type f`; do fi case "$file_name" in *Bridge.php) yes | cp "$file" /app/bridges/ ; - chown www-data:www-data /app/bridges/$file_name; + chown www-data:www-data "/app/bridges/$file_name"; printf "Custom Bridge %s added.\n" $file_name;; config.ini.php) yes | cp "$file" /app/ ; - chown www-data:www-data /app/$file_name; + chown www-data:www-data "/app/$file_name"; printf "Custom config.ini.php added.\n";; whitelist.txt) yes | cp "$file" /app/ ; - chown www-data:www-data /app/$file_name; + chown www-data:www-data "/app/$file_name"; printf "Custom whitelist.txt added.\n";; esac done From 7478ea978f7cfdc27294aec12c0205e4f128e29b Mon Sep 17 00:00:00 2001 From: Bockiii Date: Sat, 1 May 2021 21:43:04 +0200 Subject: [PATCH 4/6] [Config] Missing space Co-authored-by: Evo <28950897+verahawk@users.noreply.github.com> --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 07c25549901..fa3c91fc4d0 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -6,7 +6,7 @@ for file in `find /config/ -type f`; do file_name="$(basename "$file")" # Strip leading path - if [[ $file_name= *" "* ]]; then + if [[ $file_name = *" "* ]]; then printf 'Custom Bridge %s has a space in the name and will be skipped.\n' "$file_name" break fi From fdd89b7d7ad86c4da5a4e443f1482dcb5b008dfa Mon Sep 17 00:00:00 2001 From: Henning Bocklage Date: Sat, 1 May 2021 22:17:30 +0200 Subject: [PATCH 5/6] [Config] Adapt description for readability --- docker-entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index fa3c91fc4d0..04995dcc58f 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash -# Find custom files in the /config folder and copy them to the respective folders in /app. -# Look for bridges that end in 'Bridge.php' and for the whitelist and config.ini files. Everything else is ignored -# This will overwrite previous configs and bridges. It also uses the default paths of the configs and bridges, so if there is no file that matches, rss-bridge works like default. +# - Find custom files (bridges, whitelist, config.ini) in the /config folder +# - Copy them to the respective folders in /app +# This will overwrite previous configs and bridges of same name +# If there are no matching files, rss-bridge works like default. for file in `find /config/ -type f`; do file_name="$(basename "$file")" # Strip leading path From c2ed66996a65cfc33e0155bebcd5311d8c6d44dd Mon Sep 17 00:00:00 2001 From: Bocki Date: Sat, 1 May 2021 20:43:46 +0000 Subject: [PATCH 6/6] [Config] Add executable flag --- docker-entrypoint.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 docker-entrypoint.sh diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh old mode 100644 new mode 100755