docker-transmission-openvpn/privoxy/scripts/start.sh
Jonathan Dilks 98ee55b9da
Privoxy in place of tinyproxy #1758 (#1760)
* Use latest Privoxy from source tarball

* PRIVOXY only, tinyproxy/ enc config stuff comment out

* Privoxy config dir fix

* Privoxy 3.0.29 is stable

* Remove commented out code

* Implement `make install-strip` suggestion :)

* Refactor all tinyproxy references to privoxy

* refactor scripts to sub folder

* Should be able to set privoxy WEBPROXY_PORT dynamically via sed

* Fix tinyproxy references

* Update openvpn/tunnelUp.sh

Co-authored-by: Amos Shapira <amos.shapira@gmail.com>

* No more weird indents

* PrivoxyBuilder

* Add pcre mbedtls non dev packages to image

* Update openvpn/tunnelDown.sh

Co-authored-by: Amos Shapira <amos.shapira@gmail.com>

* Update web-proxy.md

Co-authored-by: Jonathan Dilks <jay-to-the-dee@users.noreply.github.com>
Co-authored-by: Amos Shapira <amos.shapira@gmail.com>
Co-authored-by: Patrick Kishino <patrick.a.kishino@gmail.com>
2021-03-27 06:22:58 +09:00

56 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Source our persisted env variables from container startup
. /etc/transmission/environment-variables.sh
find_proxy_conf()
{
if [[ -f /usr/local/etc/privoxy/config ]]; then
PROXY_CONF='/usr/local/etc/privoxy/config'
elif [[ -f /usr/local/etc/privoxy/privoxy/config ]]; then
PROXY_CONF='/usr/local/etc/privoxy/privoxy/config'
else
echo "ERROR: Could not find privoxy config file. Exiting..."
exit 1
fi
}
set_port()
{
expr $1 + 0 1>/dev/null 2>&1
status=$?
if test ${status} -gt 1
then
echo "Port [$1]: 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 "Setting privoxy port to $1";
sed -i -e"s,^listen-address .*,listen-address 0.0.0.0:$1," $2
}
if [[ "${WEBPROXY_ENABLED}" = "true" ]]; then
echo "STARTING PRIVOXY"
find_proxy_conf
echo "Found config file $PROXY_CONF, updating settings."
set_port ${WEBPROXY_PORT} ${PROXY_CONF}
cd /usr/local/etc/privoxy
/usr/local/sbin/privoxy config
echo "privoxy startup script complete."
fi