mirror of
https://github.com/haugene/docker-transmission-openvpn.git
synced 2025-08-06 22:37:18 +02:00
* Add Transmissionic Web UI & New Documentation (#2589) * Added step to build a .deb file to install and reduce image size (#2590) * Added step to build a .deb file to install and reduce image size * Fixed deb install incorrectly done * Check for update-port script existing instead of being executable (#2593) #2459 * Fixed TWC paths (#2600) * add docker build caching to workflow (#2609) * Privoxy eth0 fixes, healthcheck comparison tweak and start.sh update (#2610) * by checking for existence of default 127 address,healthcheck will never effectively run, as the non-default eth0 ip will never be matched * the comparison was not trimming off the port, thus healthcheck was always going to fail or denote a change when there may have been none * simplified the comparison (thanks @edgd1er ) * Strip double quotes from umask check (#2601) * Fix problem with enabled UFW with Random Ports (#2603) Fixing #2255 * move vpn config download to /config (#2592) * move vpn config download to /config * fix git safe dir permissions * cleanup vpn config clone * re-add zip dl, set git to default * use alpine:latest for TransmissionUIs build stage (#2573) * Update fetch-external-configs.sh removed duplicate bracket * Update to transmission 4.0.4 * Update configure-openvpn.sh --------- Co-authored-by: Anastasiya Polina Soyka <apsoyka@protonmail.com> Co-authored-by: Geoff <geoff@gapple.ca> Co-authored-by: ksurl <ksurl@users.noreply.github.com> Co-authored-by: HeavyGee <133152184+heavygee@users.noreply.github.com> Co-authored-by: WitchRecipe <77073792+WitchRecipe@users.noreply.github.com> Co-authored-by: Florian Kretschmer <19738301+Entepotenz@users.noreply.github.com>
122 lines
4.7 KiB
Bash
Executable File
122 lines
4.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
source /etc/openvpn/utils.sh
|
|
|
|
# Source our persisted env variables from container startup
|
|
. /etc/transmission/environment-variables.sh
|
|
|
|
# This script will be called with OpenVPN environment variables
|
|
# See https://openvpn.net/community-resources/reference-manual-for-openvpn-2-4/#scripting-and-environmental-variables
|
|
echo "Up script executed with device=$dev ifconfig_local=$ifconfig_local"
|
|
if [[ "$ifconfig_local" = "" ]]; then
|
|
echo "ERROR, unable to obtain tunnel address"
|
|
echo "killing $PPID"
|
|
kill -9 $PPID
|
|
exit 1
|
|
fi
|
|
|
|
# Re-create `--up` command arguments to maintain compatibility with old user scripts
|
|
USER_SCRIPT_ARGS=("$dev" "$tun_mtu" "$link_mtu" "$ifconfig_local" "$ifconfig_remote" "$script_context")
|
|
|
|
# If transmission-pre-start.sh exists, run it
|
|
if [[ -x /scripts/transmission-pre-start.sh ]]; then
|
|
echo "Executing /scripts/transmission-pre-start.sh"
|
|
/scripts/transmission-pre-start.sh "${USER_SCRIPT_ARGS[@]}"
|
|
echo "/scripts/transmission-pre-start.sh returned $?"
|
|
fi
|
|
|
|
echo "Updating TRANSMISSION_BIND_ADDRESS_IPV4 to the ip of $dev : $ifconfig_local"
|
|
export TRANSMISSION_BIND_ADDRESS_IPV4=$ifconfig_local
|
|
# Also update the persisted settings in case it is already set. First remove any old value, then add new.
|
|
sed -i '/TRANSMISSION_BIND_ADDRESS_IPV4/d' /etc/transmission/environment-variables.sh
|
|
echo "export TRANSMISSION_BIND_ADDRESS_IPV4=$ifconfig_local" >>/etc/transmission/environment-variables.sh
|
|
|
|
if [[ "combustion" = "$TRANSMISSION_WEB_UI" ]]; then
|
|
echo "Using Combustion UI, overriding TRANSMISSION_WEB_HOME"
|
|
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/combustion-release
|
|
fi
|
|
|
|
if [[ "kettu" = "$TRANSMISSION_WEB_UI" ]]; then
|
|
echo "Using Kettu UI, overriding TRANSMISSION_WEB_HOME"
|
|
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/kettu
|
|
fi
|
|
|
|
if [[ "transmission-web-control" = "$TRANSMISSION_WEB_UI" ]]; then
|
|
echo "Using Transmission Web Control UI, overriding TRANSMISSION_WEB_HOME"
|
|
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/transmission-web-control
|
|
fi
|
|
|
|
if [[ "flood-for-transmission" = "$TRANSMISSION_WEB_UI" ]]; then
|
|
echo "Using Flood for Transmission UI, overriding TRANSMISSION_WEB_HOME"
|
|
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/flood-for-transmission
|
|
fi
|
|
|
|
if [[ "shift" = "$TRANSMISSION_WEB_UI" ]]; then
|
|
echo "Using Shift UI, overriding TRANSMISSION_WEB_HOME"
|
|
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/shift
|
|
fi
|
|
|
|
if [[ "transmissionic" = "$TRANSMISSION_WEB_UI" ]]; then
|
|
echo "Using Transmissionic UI, overriding TRANSMISSION_WEB_HOME"
|
|
export TRANSMISSION_WEB_HOME=/opt/transmission-ui/transmissionic
|
|
fi
|
|
|
|
case ${TRANSMISSION_LOG_LEVEL,,} in
|
|
"trace" | "debug" | "info" | "warn" | "error" | "critical")
|
|
echo "Will exec Transmission with '--log-level=${TRANSMISSION_LOG_LEVEL,,}' argument"
|
|
export TRANSMISSION_LOGGING="--log-level=${TRANSMISSION_LOG_LEVEL,,}"
|
|
;;
|
|
*)
|
|
export TRANSMISSION_LOGGING=""
|
|
;;
|
|
esac
|
|
|
|
. /etc/transmission/userSetup.sh
|
|
|
|
echo "Updating Transmission settings.json with values from env variables"
|
|
# Ensure TRANSMISSION_HOME is created
|
|
mkdir -p ${TRANSMISSION_HOME}
|
|
python3 /etc/transmission/updateSettings.py /etc/transmission/default-settings.json ${TRANSMISSION_HOME}/settings.json || exit 1
|
|
|
|
echo "sed'ing True to true"
|
|
sed -i 's/True/true/g' ${TRANSMISSION_HOME}/settings.json
|
|
|
|
if [[ ! -e "/dev/random" ]]; then
|
|
# Avoid "Fatal: no entropy gathering module detected" error
|
|
echo "INFO: /dev/random not found - symlink to /dev/urandom"
|
|
ln -s /dev/urandom /dev/random
|
|
fi
|
|
|
|
if [[ "true" = "$DROP_DEFAULT_ROUTE" ]]; then
|
|
echo "DROPPING DEFAULT ROUTE"
|
|
# Remove the original default route to avoid leaks.
|
|
/sbin/ip route del default via "${route_net_gateway}" || exit 1
|
|
fi
|
|
|
|
if [[ "true" = "$LOG_TO_STDOUT" ]]; then
|
|
LOGFILE=/dev/stdout
|
|
else
|
|
LOGFILE=${TRANSMISSION_HOME}/transmission.log
|
|
fi
|
|
|
|
echo "STARTING TRANSMISSION"
|
|
|
|
exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "/usr/local/bin/transmission-daemon ${TRANSMISSION_LOGGING} -g ${TRANSMISSION_HOME} --logfile $LOGFILE" &
|
|
|
|
|
|
# Configure port forwarding if applicable
|
|
if [[ -f /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && (-z $DISABLE_PORT_UPDATER || "false" = "$DISABLE_PORT_UPDATER") ]]; then
|
|
echo "Provider ${OPENVPN_PROVIDER^^} has a script for automatic port forwarding. Will run it now."
|
|
echo "If you want to disable this, set environment variable DISABLE_PORT_UPDATER=true"
|
|
exec /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh &
|
|
fi
|
|
|
|
# If transmission-post-start.sh exists, run it
|
|
if [[ -x /scripts/transmission-post-start.sh ]]; then
|
|
echo "Executing /scripts/transmission-post-start.sh"
|
|
/scripts/transmission-post-start.sh "${USER_SCRIPT_ARGS[@]}"
|
|
echo "/scripts/transmission-post-start.sh returned $?"
|
|
fi
|
|
|
|
echo "Transmission startup script complete."
|