Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
lonord committed Jul 31, 2021
1 parent eb28ceb commit 7d54341
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ env:
global:
- PACKAGE=luci-app-ss-domain-rule
- DOWNLOAD_DIR=${HOME}/files
- SDK_PATH=https://downloads.openwrt.org/releases/18.06.8/targets/x86/64
- SDK=-sdk-18.06.8-x86-64_
- SDK_PATH=https://downloads.openwrt.org/releases/18.06.7/targets/x86/64
- SDK=-sdk-18.06.7-x86-64_
- CONFIG_CCACHE=y
install:
- mkdir -p "$HOME/files" && cd "$HOME/files"
Expand Down Expand Up @@ -46,11 +46,11 @@ install:
- test -d "feeds" && rm -rf feeds || true
- ln -s "$HOME/dl" dl
- ln -s "$HOME/feeds" feeds
- echo "src-git base https://github.com/openwrt/openwrt.git" >feeds.conf
- echo "src-git packages https://github.com/openwrt/packages.git" >>feeds.conf
- echo "src-git luci https://github.com/openwrt/luci.git" >>feeds.conf
- echo "src-git routing https://git.openwrt.org/feed/routing.git" >>feeds.conf
- echo "src-git telephony https://github.com/openwrt/telephony.git" >>feeds.conf
- echo "src-git base https://github.com/openwrt/openwrt.git;v18.06.7" >feeds.conf
- echo "src-git packages https://github.com/openwrt/packages.git^925068d4f8366240d2aeb2d69b3df12382320ec3" >>feeds.conf
- echo "src-git luci https://github.com/openwrt/luci.git^41e2258d6dc1ebe8d3874ae6d6b13db49cff2c5c" >>feeds.conf
- echo "src-git routing https://git.openwrt.org/feed/routing.git^0e63ef9276bf41c0d4176127f9f047343b8ffe32" >>feeds.conf
- echo "src-git telephony https://github.com/openwrt/telephony.git^8ecbdabc7c5cadbe571eb947f5cd333a5a785010" >>feeds.conf
- ln -s "$TRAVIS_BUILD_DIR" "package/$PACKAGE"
script:
- cd "$SDK_HOME"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-ss-domain-rule
PKG_VERSION:=1.0.4
PKG_VERSION:=1.0.5
PKG_RELEASE:=1

PKG_LICENSE:=GPLv3
Expand Down
10 changes: 8 additions & 2 deletions root/etc/init.d/ss-domain-rule
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ DNSMASQ_RULE=$DNSMASQ_CONF_DIR/ss-domain-rule.conf

DATA_DIR=/etc/ss-domain-rule
GFWLIST_CACHE=$DATA_DIR/gfwlist_domain.txt
GFWLIST_CACHE_TMP=/tmp/gfwlist_domain.txt.tmp
GFWLIST_TIMESTAMP=$DATA_DIR/update_time.txt
GFWLIST_FETCH_ADDR=https://cokebar.github.io/gfwlist2dnsmasq/gfwlist_domain.txt

Expand Down Expand Up @@ -138,8 +139,13 @@ unset_cron() {
download_gfwlist() {
# echo "DEBUG - download_gfwlist start"
test -d $DATA_DIR || mkdir -p $DATA_DIR
wget -q --timeout=15 -O $GFWLIST_CACHE $GFWLIST_FETCH_ADDR 2>&1 | $LOG_ERR
echo "$(date)" > $GFWLIST_TIMESTAMP
wget -q --timeout=15 -O $GFWLIST_CACHE_TMP $GFWLIST_FETCH_ADDR 2>&1 | $LOG_ERR
if [ $? -eq 0 -a -n "$(head $GFWLIST_CACHE_TMP)" ]; then
mv $GFWLIST_CACHE_TMP $GFWLIST_CACHE
echo "$(date)" > $GFWLIST_TIMESTAMP
else
echo "gfwlist update failed"
fi
# echo "DEBUG - download_gfwlist end"
}

Expand Down

0 comments on commit 7d54341

Please sign in to comment.