luci-app-mosdns: mosdns.sh: ash compatible fix #35

This commit is contained in:
sbwml 2022-12-01 15:36:38 +08:00
parent 0ac1a712c8
commit 6f677a8f9d

View File

@ -39,9 +39,9 @@ ad_block() (
adlist_update() ( adlist_update() (
ad_source=$(uci -q get mosdns.config.ad_source) ad_source=$(uci -q get mosdns.config.ad_source)
[ "$ad_source" = "geosite.dat" ] && exit 0 [ "$ad_source" = "geosite.dat" ] || [ -z "$ad_source" ] && exit 0
AD_TMPDIR=$(mktemp -d) || exit 1 AD_TMPDIR=$(mktemp -d) || exit 1
if [[ "$ad_source" =~ "^https://raw.githubusercontent.com" ]]; then if echo "$ad_source" | grep -Eq "^https://raw.githubusercontent.com" ; then
google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204) google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204)
[ "$google_status" -ne "204" ] && mirror="https://ghproxy.com/" [ "$google_status" -ne "204" ] && mirror="https://ghproxy.com/"
fi fi