diff options
author | Stan Grishin <stangri@melmac.ca> | 2024-08-03 23:23:38 +0000 |
---|---|---|
committer | Stan Grishin <stangri@melmac.ca> | 2024-08-03 23:23:38 +0000 |
commit | fc9f85ffb4568fdbd2162467db4e8603acfcfa96 (patch) | |
tree | 98c51f3815088f4d88022de1299dabc1ec5d9fa2 /applications/luci-app-pbr/root/usr/libexec/rpcd | |
parent | ee1bf573ec94eb23f99c4c5edcd86e53e0300719 (diff) |
luci-app-pbr: sync with 1.1.6-20 principal package
Signed-off-by: Stan Grishin <stangri@melmac.ca>
Diffstat (limited to 'applications/luci-app-pbr/root/usr/libexec/rpcd')
-rwxr-xr-x | applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr b/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr index 8cd02c58f4..b0316d96be 100755 --- a/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr +++ b/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr @@ -11,6 +11,7 @@ # ubus -S call luci.pbr getGateways '{"name": "pbr" }' # ubus -S call luci.pbr getInterfaces '{"name": "pbr" }' +readonly luciCompat='5' readonly pbrFunctionsFile='/etc/init.d/pbr' if [ -s "$pbrFunctionsFile" ]; then # shellcheck source=../../../../../pbr/files/etc/init.d/pbr @@ -20,6 +21,23 @@ else logger -t pbr 'error' "pbr init.d file ($pbrFunctionsFile) not found!" fi +# compatibility with old luci app versions +is_running_iptables() { iptables -t mangle -L | grep -q PBR_PREROUTING >/dev/null 2>&1; } +is_running() { is_running_iptables || is_running_nft; } +check_ipset() { { [ -n "$ipset" ] && "$ipset" help hash:net; } >/dev/null 2>&1; } +check_agh_ipset() { + check_ipset || return 1 + check_agh || return 1 + is_greater_or_equal "$($agh --version | sed 's|AdGuard Home, version v\(.*\)|\1|' | sed 's|-.*||')" '0.107.13' +} +check_dnsmasq_ipset() { + local o; + check_ipset || return 1 + check_dnsmasq || return 1 + o="$(dnsmasq -v 2>/dev/null)" + ! echo "$o" | grep -q 'no-ipset' && echo "$o" | grep -q 'ipset' +} + get_init_list() { local name name="$(basename "$1")" @@ -135,12 +153,15 @@ EOF $(echo "$warnings" | tr \# \\n) EOF fi -# if is_greater "$(opkg_get_version "${name}")" "$(opkg_get_version "luci-app-${name}")"; then -# json_add_object -# json_add_string 'id' 'warningOutdatedWebUIApp' -# json_add_string 'extra' "$(opkg_get_version "luci-app-${name}")" -# json_close_object -# fi + if is_greater "${packageCompat:-0}" "${luciCompat:-0}"; then + json_add_object + json_add_string 'id' 'warningOutdatedLuciPackage' + json_close_object + elif is_greater "${luciCompat:-0}" "${packageCompat:-0}"; then + json_add_object + json_add_string 'id' 'warningOutdatedPrincipalPackage' + json_close_object + fi json_close_array json_close_object json_dump @@ -234,7 +255,7 @@ get_supported_interfaces() { for i in $supported_interface; do is_xray "$i" && ifacesSupported="$ifacesSupported $i" done - [ "$webui_show_ignore_target" -eq "1" ] && ifacesSupported="$ifacesSupported ignore" + [ "$webui_show_ignore_target" -eq '1' ] && ifacesSupported="$ifacesSupported ignore" json_init json_add_object "$packageName" json_add_array 'interfaces' |