summaryrefslogtreecommitdiffstats
path: root/remote/modules/redsocks/data/opt
diff options
context:
space:
mode:
authorSimon Rettberg2013-06-20 17:16:35 +0200
committerSimon Rettberg2013-06-20 17:16:35 +0200
commiteb8fb86b50928d2f03d3d0932893f9099614233c (patch)
tree3a859efca338510f973073b9a124c726f3e45211 /remote/modules/redsocks/data/opt
parent[udhcpc] Properly renew and fork to background (diff)
downloadtm-scripts-eb8fb86b50928d2f03d3d0932893f9099614233c.tar.gz
tm-scripts-eb8fb86b50928d2f03d3d0932893f9099614233c.tar.xz
tm-scripts-eb8fb86b50928d2f03d3d0932893f9099614233c.zip
[redsocks] Make it work more good and less bad
Diffstat (limited to 'remote/modules/redsocks/data/opt')
-rwxr-xr-xremote/modules/redsocks/data/opt/openslx/bin/setup_proxy9
1 files changed, 9 insertions, 0 deletions
diff --git a/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy b/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy
index 5dc22a14..6c39c077 100755
--- a/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy
+++ b/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy
@@ -1,5 +1,12 @@
#!/bin/bash
+for wait in 1 1 2 3 4 6 8 10 end; do
+ grep '^#_RCONFIG_TAG$' /opt/openslx/config > /dev/null && echo "Config found!" && break
+ [ "$wait" == "end" ] && echo "Giving up!" && exit 1
+ echo "No config yet..."
+ sleep $wait
+done
+
. /opt/openslx/config || echo "Error sourcing config for setup_proxy"
[ -z "$SLX_PROXY_MODE" -o "x$SLX_PROXY_MODE" == "xoff" ] && echo "proxy mode disabled." && exit 0
@@ -17,6 +24,8 @@ fi
sed -i "s/%%PROXY_IP%%/$SLX_PROXY_IP/g;s/%%PROXY_PORT%%/$SLX_PROXY_PORT/g;s/%%PROXY_TYPE%%/$SLX_PROXY_TYPE/g" /etc/redsocks.conf
+mkdir -p /run/redsocks
+chown redsocks:redsocks /run/redsocks
systemctl start redsocks
iptables -t nat -N REDSOCKS