docker-transmission-openvpn/plugins/rss/start.sh
Patrick Kishino 9d975aba54
merge in latest dev (#1712)
* Brush up proxy and rss plugin images, build for multiarch support #1483

* Escape special characters in rss-plugin input variables #1565

* Increase healthcheck ping timeout (#1627)

* Add DNS resolution checks (fix #1608) (#1617)

* Add dns resolution test to healthcheck script

* Add dns resolution test to start script

Co-authored-by: Patrick Kishino <patrick.a.kishino@gmail.com>

* Fix PIA infinite redirect on config download (see #1619) (#1620)

PIA download link was redirecting and setting a cookie, but those are
disabled by default unless `--cookie` or `--cookie-jar` are given. Since
the cookie was not set, the redirection was attempted again until we
reached the maximum redirection limit.

The `--cookie /dev/null` specifies an empty input cookie, which has the
effect to enable curl's handling of cookies.

Co-authored-by: Kristian Haugene <kristian@haugene.net>
Co-authored-by: clement-z <6691770+clement-z@users.noreply.github.com>
2021-02-12 09:23:42 +09:00

39 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
#
# This script tries to figure out how the container is configured.
# The user has two options:
# 1. Mount a custom config file to be used
# 2. Use the built in template that supports one feed with regex filter
#
if [ -f /etc/transmission-rss.conf ] ; then
echo "Found mounted /etc/transmission-rss.conf file"
elif [ -z "${RSS_URL}" ] || [ "${RSS_URL}" = "**None**" ] ; then
echo "Error: No config is mounted and RSS_URL is not defined."
echo "Have no config to start from. Exit with error code."
exit 1
else
# The RSS url can (and usually does) contain special chars. We need to escape them
rss_url_esc=$(printf '%q' "$RSS_URL")
rss_regex_esc=$(printf '%q' "$RSS_REGEXP")
# Configure plugin based on template. Use sed to insert
sed "s^url: placeholder^url: $rss_url_esc^" < /etc/transmission-rss/transmission-rss.tmpl \
| sed "s^download_path: placeholder^download_path: $TRANSMISSION_DOWNLOAD_DIR^" \
> /etc/transmission-rss.conf
if [ -z "${RSS_REGEXP}" ] ; then
sed -i '/regexp/d' /etc/transmission-rss.conf
else
sed -i "s#regexp: placeholder#regexp: $rss_regex_esc#" /etc/transmission-rss.conf
fi
fi
echo "Starting RSS plugin with the following config:"
echo
cat /etc/transmission-rss.conf
echo
transmission-rss