Merge pull request #4324 from MilhouseVH/le10_iptables_helper_noise

iptables: fix helper script
This commit is contained in:
Christian Hewitt 2020-04-17 06:11:46 +04:00 committed by GitHub
commit 677f569ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
#!/bin/sh -
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
@ -14,18 +14,22 @@ SYSTEMCTL="/usr/bin/systemctl"
CONNMANCTL="/usr/bin/connmanctl"
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() {
if [ -n "`$CONNMANCTL technologies | grep -e -A5 technology/wifi -e 'Tethering = True'`" ]; then
TECHNOLOGY="wifi"
elif [ -n "`$CONNMANCTL technologies | grep -e -A5 technology/ethernet -e 'Tethering = True'`" ]; then
TECHNOLOGY="ethernet"
for technology in wifi ethernet; do
if get_technology_config $technology | grep -q 'Tethering = True'; then
$CONNMANCTL tether $technology off
sleep 1
$CONNMANCTL tether $technology on
break
fi
$CONNMANCTL tether $TECHNOLOGY off
sleep 1
$CONNMANCTL tether $TECHNOLOGY on
done
}
flush() {