iptables: fix helper script

This commit is contained in:
MilhouseVH 2020-04-15 06:18:45 +01:00
parent 3fefed3376
commit e5dc90f3c7

View File

@ -1,4 +1,4 @@
#!/bin/sh - #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
@ -14,18 +14,22 @@ SYSTEMCTL="/usr/bin/systemctl"
CONNMANCTL="/usr/bin/connmanctl" CONNMANCTL="/usr/bin/connmanctl"
check_docker() { check_docker() {
$SYSTEMCTL is-active --quiet $DOCKER && $SYSTEMCTL restart $DOCKER $SYSTEMCTL is-active --quiet $DOCKER && $SYSTEMCTL restart $DOCKER
}
get_technology_config() {
$CONNMANCTL technologies | awk -v pattern="^/.*/technology/$1$" -e 'BEGIN {S=0}; /^\/.*/ {S=0}; $0 ~ pattern {S=1}; S==1 {print $0}'
} }
check_tether() { check_tether() {
if [ -n "`$CONNMANCTL technologies | grep -e -A5 technology/wifi -e 'Tethering = True'`" ]; then for technology in wifi ethernet; do
TECHNOLOGY="wifi" if get_technology_config $technology | grep -q 'Tethering = True'; then
elif [ -n "`$CONNMANCTL technologies | grep -e -A5 technology/ethernet -e 'Tethering = True'`" ]; then $CONNMANCTL tether $technology off
TECHNOLOGY="ethernet" sleep 1
$CONNMANCTL tether $technology on
break
fi fi
$CONNMANCTL tether $TECHNOLOGY off done
sleep 1
$CONNMANCTL tether $TECHNOLOGY on
} }
flush() { flush() {