docker-transmission-openvpn/privoxy/scripts/start.sh
Patrick Kishino 83dc92c884
update master (#2696)
* 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

* Switched the order of events, to remove the ipv6 before sed-ing the address (#2695)

* Create separate image for transmission build from source (#2691)

* separate transmission build to separate image and workflow

* set transmission-builder version

* use matrix for multi runner builds

* fix context

* parallel docker builds with matrix (#2694)

* consolidate and parallelize image build with matrix multi runner build

* fix image name

* Update Dockerfile

fixed typo

* `TRANSMISSION_RPC_URL` option causes a moved permanently error when using PIA (#2657)

* Respect option `TRANSMISSION_RPC_URL`

remove debug echo

* default `TRANSMISSION_RPC_URL` is now grabbed from `default-settings.json`

* Stricter grep pattern

* Remove redundant grep

* Added comment

* Use `jq` instead of `sed` to determine the default of `TRANSMISSION_RPC_URL`

---------

Co-authored-by: Mark Honkoop <112875887+MarkHonkoop@users.noreply.github.com>

* Fix for PR #2691 (#2698)

* separate transmission build to separate image and workflow

* set transmission-builder version

* use matrix for multi runner builds

* fix context

* Fix file name

* fix image name

---------

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>
Co-authored-by: Aemulation <112875887+Aemulation@users.noreply.github.com>
Co-authored-by: Mark Honkoop <112875887+MarkHonkoop@users.noreply.github.com>
2023-09-04 12:07:20 +09:00

60 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";
# Remove the listen-address for IPv6 for now. IPv6 compatibility should come later
sed -i -E "s/^listen-address\s+\[\:\:1.*//" "$2"
# 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"
}
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