docker-transmission-openvpn/privoxy/scripts/start.sh
Patrick Kishino 48299204d1
Update main to dev (#2689)
* 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>
2023-08-30 10:55:13 +09:00

59 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Source our persisted env variables from container startup
. /etc/transmission/environment-variables.sh
source /etc/openvpn/utils.sh
set_port()
{
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "Privoxy: ERROR. Supplied port $1 is not a number" >&2; exit 1
fi
# Port: Specify the port which privoxy will listen on. Please note
# that should you choose to run on a port lower than 1024 you will need
# to start privoxy using root.
if test "$1" -lt 1024
then
echo "privoxy: $1 is lower than 1024. Ports below 1024 are not permitted.";
exit 1
fi
echo "Privoxy: Setting port to $1";
# Set the port for the IPv4 interface
adr=$(ip -4 a show eth0| grep -oP "(?<=inet )([^/]+)")
adr=${adr:-"0.0.0.0"}
sed -i -E "s/^listen-address\s+.*/listen-address ${adr}:$1/" "$2"
# Remove the listen-address for IPv6 for now. IPv6 compatibility should come later
sed -i -E "s/^listen-address\s+\[\:\:1.*//" "$2"
}
if [[ "${WEBPROXY_ENABLED}" = "true" ]]; then
echo "Privoxy: Starting"
PROXY_CONF=/etc/privoxy/config
echo "Privoxy: Using config file at $PROXY_CONF"
set_port "${WEBPROXY_PORT}" "${PROXY_CONF}"
/usr/sbin/privoxy --pidfile /opt/privoxy/pidfile ${PROXY_CONF}
sleep 1 # Give it one sec to start up, or at least create the pidfile
if [[ -f /opt/privoxy/pidfile ]]; then
privoxy_pid=$(cat /opt/privoxy/pidfile)
echo "Privoxy: Running as PID $privoxy_pid"
else
echo "Privoxy: ERROR. Did not start correctly, outputting logs"
echo
cat /var/log/privoxy/logfile
echo
fi
fi