From cbb780da47fbe52dc0ecc80e5ecef9f00b55fb63 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Wed, 4 Mar 2020 20:44:45 +0800 Subject: [PATCH] luci-app-clash: bump to 1.6.0b --- package/ntlf9t/luci-app-clash/Makefile | 2 +- .../luci-app-clash/root/etc/init.d/clash | 5 ++- .../usr/share/clash/check_luci_version.sh | 2 +- .../root/usr/share/clash/clash-watchdog.sh | 19 ++-------- .../root/usr/share/clash/core_download.sh | 36 ++----------------- .../root/usr/share/clash/kill_watchdog.sh | 19 ++++++++++ .../root/usr/share/clash/luci_version | 2 +- 7 files changed, 28 insertions(+), 57 deletions(-) create mode 100755 package/ntlf9t/luci-app-clash/root/usr/share/clash/kill_watchdog.sh diff --git a/package/ntlf9t/luci-app-clash/Makefile b/package/ntlf9t/luci-app-clash/Makefile index e6f1900ff6..2b16992cd5 100644 --- a/package/ntlf9t/luci-app-clash/Makefile +++ b/package/ntlf9t/luci-app-clash/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-clash -PKG_VERSION:=1.5.9 +PKG_VERSION:=1.6.0 PKG_MAINTAINER:=frainzy1477 diff --git a/package/ntlf9t/luci-app-clash/root/etc/init.d/clash b/package/ntlf9t/luci-app-clash/root/etc/init.d/clash index 006f3b9796..01340b8c82 100644 --- a/package/ntlf9t/luci-app-clash/root/etc/init.d/clash +++ b/package/ntlf9t/luci-app-clash/root/etc/init.d/clash @@ -33,10 +33,8 @@ revert_dns() { add_cron(){ config_type=$(uci get clash.config.config_type 2>/dev/null) #=========================================================================================================================== - sed -i '/clash.txt/d' $CRON_FILE - [ -z "$(grep -w "/usr/share/clash/clash-watchdog.sh" $CRON_FILE)" ] && echo "*/1 * * * * /usr/share/clash/clash-watchdog.sh" >> $CRON_FILE - + [ -z "$(grep -w "/usr/share/clash/kill_watchdog.sh" $CRON_FILE)" ] && echo "*/1 * * * * /usr/share/clash/kill_watchdog.sh" >> $CRON_FILE clear=$(uci get clash.config.auto_clear_log 2>/dev/null) if [ "${clear}" -eq 1 ]; then [ -z "$(grep -w "/usr/share/clash/clash.txt" $CRON_FILE)" ] && echo "0 */$(uci get clash.config.clear_time 2>/dev/null) * * * echo '' >/usr/share/clash/clash.txt" >> $CRON_FILE @@ -70,6 +68,7 @@ config_type=$(uci get clash.config.config_type 2>/dev/null) del_cron(){ #=========================================================================================================================== + sed -i '/clash-watchdog.sh/d' $CRON_FILE sed -i '/update_all.sh/d' $CRON_FILE sed -i '/clash.txt/d' $CRON_FILE /etc/init.d/cron restart diff --git a/package/ntlf9t/luci-app-clash/root/usr/share/clash/check_luci_version.sh b/package/ntlf9t/luci-app-clash/root/usr/share/clash/check_luci_version.sh index 0f8ecf7781..7f54ae93e5 100755 --- a/package/ntlf9t/luci-app-clash/root/usr/share/clash/check_luci_version.sh +++ b/package/ntlf9t/luci-app-clash/root/usr/share/clash/check_luci_version.sh @@ -6,6 +6,6 @@ new_version=`wget -qO- "https://github.com/frainzy1477/luci-app-clash/tags"| gre if [ $new_version ]; then echo $new_version > /usr/share/clash/new_luci_version 2>&1 & >/dev/null elif [ $new_version =="" ]; then -echo 0 > /usr/share/clash/new__luci_version 2>&1 & >/dev/null +echo 0 > /usr/share/clash/new_luci_version 2>&1 & >/dev/null fi \ No newline at end of file diff --git a/package/ntlf9t/luci-app-clash/root/usr/share/clash/clash-watchdog.sh b/package/ntlf9t/luci-app-clash/root/usr/share/clash/clash-watchdog.sh index 3ff0a098c3..6fb93110fa 100755 --- a/package/ntlf9t/luci-app-clash/root/usr/share/clash/clash-watchdog.sh +++ b/package/ntlf9t/luci-app-clash/root/usr/share/clash/clash-watchdog.sh @@ -2,27 +2,12 @@ enable=$(uci get clash.config.enable 2>/dev/null) if [ "${enable}" -eq 1 ];then - - if ! pidof clash>/dev/null; then /etc/init.d/clash restart 2>&1 & fi - -elif [ "${enable}" -eq 0 ];then - -if [ -f /tmp/watchlist ];then -rm -rf /tmp/watchlist -fi -line=$(ps | grep -n 'clash-watchdog.sh'|awk -F ':' '{print $2}' |awk -F ' ' '{print $1}'>/tmp/watchlist) -line_no=$(grep -n '' /tmp/watchlist|awk -F ':' '{print $1}') -num=$(grep -c '' /tmp/watchlist| awk '{print $1}') -nums=1 -while [[ $nums -le $num ]] -do - kill -9 $(sed -n "$nums"p /tmp/watchlist| awk '{print $1}') >/dev/null 2>&1 - nums=$(( $nums + 1)) -done fi + + diff --git a/package/ntlf9t/luci-app-clash/root/usr/share/clash/core_download.sh b/package/ntlf9t/luci-app-clash/root/usr/share/clash/core_download.sh index fdb3a2d0c8..00a7427d26 100755 --- a/package/ntlf9t/luci-app-clash/root/usr/share/clash/core_download.sh +++ b/package/ntlf9t/luci-app-clash/root/usr/share/clash/core_download.sh @@ -81,24 +81,6 @@ CLASHVER=$(sed -n 1p /usr/share/clash/download_core_version 2>/dev/null) fi fi -if [ -f /usr/share/clash/core_version ];then -VER=$(rm -rf /usr/share/clash/core_version 2>/dev/null && /etc/clash/clash -v | awk -F ' ' '{print $2}' >> /usr/share/clash/core_version 2>/dev/null | sed -n 1p /usr/share/clash/core_version) -else -VER=0 -fi - - if [ -f /usr/share/clash/corer_version ];then -VERR=$(rm -rf /usr/share/clash/corer_version 2>/dev/null && /usr/bin/clash -v | awk -F ' ' '{print $2}' >> /usr/share/clash/corer_version 2>/dev/null | sed -n 1p /usr/share/clash/corer_version) -else -VERR=0 -fi - - if [ -f /usr/share/clash/tun_version ];then -VERS=$(rm -rf /usr/share/clash/tun_version 2>/dev/null && /etc/clash/clashtun/clash -v | awk -F ' ' '{print $2}' >> /usr/share/clash/tun_version | sed -n 1p /usr/share/clash/tun_version) -else -VERS=0 -fi - sleep 2 update(){ @@ -199,21 +181,7 @@ update(){ fi } -if [ $CORETYPE -eq 1 ] && [ $VER != $CLASHVER ]; then +if [ $CORETYPE -eq 1 ] || [ $CORETYPE -eq 2 ] || [ $CORETYPE -eq 3 ]; then update -elif [ $CORETYPE -eq 2 ] && [ $VERR != $CLASHRVER ]; then - update -elif [ $CORETYPE -eq 3 ] && [ $VERS != $CLASHTUN ]; then - update -else - if [ $lang == "zh_cn" ];then - echo " ${LOGTIME} - 在用中是最新的内核!" >$LOG_FILE - elif [ $lang == "en" ] || [ $lang == "auto" ];then - echo " ${LOGTIME} - Currently using latest core" >$LOG_FILE - fi - sleep 2 - touch /usr/share/clash/core_down_complete >/dev/null 2>&1 - sleep 2 - rm -rf /var/run/core_update >/dev/null 2>&1 - fi + diff --git a/package/ntlf9t/luci-app-clash/root/usr/share/clash/kill_watchdog.sh b/package/ntlf9t/luci-app-clash/root/usr/share/clash/kill_watchdog.sh new file mode 100755 index 0000000000..f151d798ab --- /dev/null +++ b/package/ntlf9t/luci-app-clash/root/usr/share/clash/kill_watchdog.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +enable=$(uci get clash.config.enable 2>/dev/null) +if [ "${enable}" -eq 0 ];then + +if [ -f /tmp/watchlist ];then +rm -rf /tmp/watchlist +fi +line=$(ps | grep -n 'clash-watchdog.sh'|awk -F ':' '{print $2}' |awk -F ' ' '{print $1}'>/tmp/watchlist) +line_no=$(grep -n '' /tmp/watchlist|awk -F ':' '{print $1}') +num=$(grep -c '' /tmp/watchlist| awk '{print $1}') +nums=1 +while [[ $nums -le $num ]] +do + kill -9 $(sed -n "$nums"p /tmp/watchlist| awk '{print $1}') >/dev/null 2>&1 + nums=$(( $nums + 1)) +done +fi + diff --git a/package/ntlf9t/luci-app-clash/root/usr/share/clash/luci_version b/package/ntlf9t/luci-app-clash/root/usr/share/clash/luci_version index 2b26b8d213..dc1e644a10 100644 --- a/package/ntlf9t/luci-app-clash/root/usr/share/clash/luci_version +++ b/package/ntlf9t/luci-app-clash/root/usr/share/clash/luci_version @@ -1 +1 @@ -1.5.9 +1.6.0