fix the tinyproxy start script
This commit is contained in:
@@ -77,5 +77,5 @@
|
||||
#TRANSMISSION_WATCH_DIR=/data/watch
|
||||
#TRANSMISSION_WATCH_DIR_ENABLED=true
|
||||
#TRANSMISSION_HOME=/data/transmission-home
|
||||
#WEBPROXY_ENABLED=true
|
||||
#WEBPROXY_ENABLED=false
|
||||
#WEBPROXY_PORT=8888
|
||||
|
@@ -106,6 +106,8 @@ ENV OPENVPN_USERNAME=**None** \
|
||||
"TRANSMISSION_WATCH_DIR_ENABLED=true" \
|
||||
"TRANSMISSION_HOME=/data/transmission-home" \
|
||||
"ENABLE_UFW=false" \
|
||||
WEBPROXY_ENABLED=false \
|
||||
WEBPROXY_PORT=8888 \
|
||||
PUID=\
|
||||
PGID=
|
||||
|
||||
|
@@ -1,42 +1,46 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Source our persisted env variables from container startup
|
||||
. /etc/transmission/environment-variables.sh
|
||||
|
||||
PROXY_CONF='/etc/tinyproxy.conf'
|
||||
DEFAULT_PORT=8888
|
||||
|
||||
if [ "${WEBPROXY_ENABLED}" = "true" ]; then
|
||||
|
||||
echo "STARTING TINYPROXY"
|
||||
|
||||
if [ -z "$WEBPROXY_PORT" ] ; then
|
||||
set_port $WEBPROXY_PORT
|
||||
else
|
||||
# Always default back to port 8888
|
||||
set_port 8888
|
||||
fi
|
||||
|
||||
/etc/init.d/tinyproxy start
|
||||
echo "Tinyproxy startup script complete."
|
||||
|
||||
fi
|
||||
|
||||
|
||||
set_port () {
|
||||
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $1 =~ $re ]] ; then
|
||||
echo "Port: Not a number" >&2; exit 1
|
||||
set_port()
|
||||
{
|
||||
expr $1 + 0 1>/dev/null 2>&1
|
||||
statut=$?
|
||||
if test $statut -gt 1
|
||||
then
|
||||
echo "Port [$1]: Not a number" >&2; exit 1
|
||||
fi
|
||||
|
||||
# Port: Specify the port which tinyproxy will listen on. Please note
|
||||
# that should you choose to run on a port lower than 1024 you will need
|
||||
# to start tinyproxy using root.
|
||||
|
||||
if [ $1 \< 1024 ];
|
||||
then
|
||||
if test $1 -lt 1024
|
||||
then
|
||||
echo "tinyproxy: $1 is lower than 1024. Ports below 1024 are not permitted.";
|
||||
exit 1
|
||||
fi;
|
||||
fi
|
||||
|
||||
echo "Setting tinyproxy port to $1";
|
||||
sed -i -e"s,^Port .*,Port $1," $PROXY_CONF
|
||||
|
||||
sed -i -e"s,^Port .*,Port $1," $2
|
||||
}
|
||||
|
||||
if [ "${WEBPROXY_ENABLED}" = "true" ]; then
|
||||
|
||||
echo "STARTING TINYPROXY"
|
||||
|
||||
if [ -z "$WEBPROXY_PORT" ] ; then
|
||||
set_port ${WEBPROXY_PORT} ${PROXY_CONF}
|
||||
else
|
||||
# Always default back to port 8888
|
||||
set_port ${DEFAULT_PORT} ${PROXY_CONF}
|
||||
fi
|
||||
|
||||
/etc/init.d/tinyproxy start
|
||||
echo "Tinyproxy startup script complete."
|
||||
|
||||
fi
|
||||
|
@@ -79,3 +79,7 @@ export ENABLE_UFW={{ .Env.ENABLE_UFW }}
|
||||
|
||||
export PUID={{ .Env.PUID }}
|
||||
export PGID={{ .Env.PGID }}
|
||||
|
||||
# Need to pass through our tinyproxy settings
|
||||
export WEBPROXY_ENABLED={{ .Env.WEBPROXY_ENABLED }}
|
||||
export WEBPROXY_PORT={{ .Env.WEBPROXY_PORT }}
|
||||
|
Reference in New Issue
Block a user