luci-app-mosdns: dump geodata
This commit is contained in:
parent
6aaffaaf28
commit
5597a6c306
@ -6,7 +6,7 @@ PKG_RELEASE:=2
|
|||||||
|
|
||||||
LUCI_TITLE:=LuCI Support for mosdns
|
LUCI_TITLE:=LuCI Support for mosdns
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
LUCI_DEPENDS:=+mosdns +jsonfilter +luci-compat +curl +v2ray-geoip +v2ray-geosite
|
LUCI_DEPENDS:=+mosdns +jsonfilter +luci-compat +curl +v2ray-geoip +v2ray-geosite +v2dat
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/conffiles
|
define Package/$(PKG_NAME)/conffiles
|
||||||
/etc/config/mosdns
|
/etc/config/mosdns
|
||||||
|
@ -24,6 +24,7 @@ USE_PROCD=1
|
|||||||
PROG=/usr/bin/mosdns
|
PROG=/usr/bin/mosdns
|
||||||
CONF=$(uci -q get mosdns.config.configfile)
|
CONF=$(uci -q get mosdns.config.configfile)
|
||||||
CRON_FILE=/etc/crontabs/root
|
CRON_FILE=/etc/crontabs/root
|
||||||
|
V2DAT_DIR=/usr/share/v2ray
|
||||||
|
|
||||||
get_config() {
|
get_config() {
|
||||||
config_get enabled $1 enabled 0
|
config_get enabled $1 enabled 0
|
||||||
@ -121,14 +122,22 @@ delcron() {
|
|||||||
crontab $CRON_FILE
|
crontab $CRON_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v2dat_dump() {
|
||||||
|
mkdir -p /var/mosdns
|
||||||
|
rm -f /var/mosdns/geo*.txt
|
||||||
|
v2dat unpack geoip -o /var/mosdns -f cn $V2DAT_DIR/geoip.dat
|
||||||
|
v2dat unpack geosite -o /var/mosdns -f cn -f 'geolocation-!cn' $V2DAT_DIR/geosite.dat
|
||||||
|
[ "$adblock" -eq 1 ] && [ "$ad_source" = "geosite.dat" ] && v2dat unpack geosite -o /var/mosdns -f category-ads-all $V2DAT_DIR/geosite.dat
|
||||||
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
config_load "mosdns"
|
config_load "mosdns"
|
||||||
config_foreach get_config "mosdns"
|
config_foreach get_config "mosdns"
|
||||||
[ $enabled != 1 ] && return 1
|
[ $enabled != 1 ] && return 1
|
||||||
delcron
|
delcron ; setcron
|
||||||
setcron
|
|
||||||
[ "${CONF}" = "/etc/mosdns/config.yaml" ] && init_yaml
|
[ "${CONF}" = "/etc/mosdns/config.yaml" ] && init_yaml
|
||||||
:> $(/usr/share/mosdns/mosdns.sh logfile)
|
:> $(/usr/share/mosdns/mosdns.sh logfile)
|
||||||
|
v2dat_dump >> $(/usr/share/mosdns/mosdns.sh logfile) 2>&1
|
||||||
procd_open_instance mosdns
|
procd_open_instance mosdns
|
||||||
procd_set_param command $PROG start -c "$CONF"
|
procd_set_param command $PROG start -c "$CONF"
|
||||||
procd_set_param user root
|
procd_set_param user root
|
||||||
|
Loading…
Reference in New Issue
Block a user