From 4cbf23597c848989bb3554c12b4eb70cab8f87c6 Mon Sep 17 00:00:00 2001 From: Bard Date: Tue, 10 Jan 2023 23:28:26 +0800 Subject: [PATCH] Update mosdns.sh --- .../root/usr/share/mosdns/mosdns.sh | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh b/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh index 25a6707..fc826aa 100755 --- a/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh +++ b/luci-app-mosdns/root/usr/share/mosdns/mosdns.sh @@ -1,5 +1,7 @@ #!/bin/sh +script_action=${1} + logfile_path() ( configfile=$(uci -q get mosdns.config.configfile) if [ "$configfile" = "/etc/mosdns/config.yaml" ]; then @@ -78,14 +80,23 @@ geodat_update() ( rm -rf "$TMPDIR" ) -if [ "$1" == "dns" ]; then - interface_dns -elif [ "$1" == "ad" ]; then - ad_block -elif [ "$1" == "geodata" ]; then - geodat_update && adlist_update -elif [ "$1" == "logfile" ]; then - logfile_path -elif [ "$1" == "adlist_update" ]; then - adlist_update -fi +case $script_action in + "dns") + interface_dns + ;; + "ad") + ad_block + ;; + "geodata") + geodat_update && adlist_update + ;; + "logfile") + logfile_path + ;; + "adlist_update") + adlist_update + ;; + *) + exit 0 + ;; +esac