diff --git a/luci-app-openclash/luasrc/controller/openclash.lua b/luci-app-openclash/luasrc/controller/openclash.lua index 7411895996..db41259660 100644 --- a/luci-app-openclash/luasrc/controller/openclash.lua +++ b/luci-app-openclash/luasrc/controller/openclash.lua @@ -221,7 +221,7 @@ local function coremodel() if fs.access("/bin/opkg") then return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null") elseif fs.access("/usr/bin/apk") then - return luci.sys.exec("apk list libc |awk '{print $2}'") + return luci.sys.exec("apk list libc 2>/dev/null |awk '{print $2}'") end end end @@ -255,7 +255,7 @@ local function opcv() if fs.access("/bin/opkg") then return luci.sys.exec("rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'") elseif fs.access("/usr/bin/apk") then - return "v" .. luci.sys.exec("apk list luci-app-openclash |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1") + return "v" .. luci.sys.exec("apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\\d+(\\.\\d+)*' | head -1") end end end diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_debug.sh b/luci-app-openclash/root/usr/share/openclash/openclash_debug.sh index 4d25dd939a..ba7bb18dea 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_debug.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_debug.sh @@ -12,6 +12,15 @@ del_lock() { rm -rf "/tmp/lock/openclash_debug.lock" } +ipk_v() +{ + if [ -x "/bin/opkg" ]; then + echo $(opkg status "$1" 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null) + elif [ -x "/usr/bin/apk" ]; then + echo $(apk list "$1" 2>/dev/null |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1) + fi +} + DEBUG_LOG="/tmp/openclash_debug.log" LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S")) set_lock @@ -31,11 +40,15 @@ en_mode=$(uci -q get openclash.config.en_mode) RAW_CONFIG_FILE=$(uci -q get openclash.config.config_path) CONFIG_FILE="/etc/openclash/$(uci -q get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)" core_model=$(uci -q get openclash.config.core_version) -cpu_model=$(ipk_v libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null) +if [ -x "/bin/opkg" ]; then + cpu_model=$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null) +elif [ -x "/usr/bin/apk" ]; then + cpu_model=$(apk list libc 2>/dev/null|awk '{print $2}') +fi core_meta_version=$(/etc/openclash/core/clash_meta -v 2>/dev/null |awk -F ' ' '{print $3}' |head -1 2>/dev/null) servers_update=$(uci -q get openclash.config.servers_update) mix_proxies=$(uci -q get openclash.config.mix_proxies) -op_version=$(ipk_v luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print "v"$2}') +op_version=$(ipk_v "luci-app-openclash") china_ip_route=$(uci -q get openclash.config.china_ip_route) common_ports=$(uci -q get openclash.config.common_ports) router_self_proxy=$(uci -q get openclash.config.router_self_proxy) @@ -80,15 +93,6 @@ ts_re() fi } -ipk_v() -{ - if [ -x "/bin/opkg" ]; then - echo $(opkg status "$1" 2>/dev/null |grep 'Version' |awk -F ': ' '{print $2}' 2>/dev/null) - elif [ -x "/usr/bin/apk" ]; then - echo $(apk list "$1" |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1) - fi -} - dns_re() { if [ "$1" = "1" ]; then diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_update.sh b/luci-app-openclash/root/usr/share/openclash/openclash_update.sh index 16496085ee..2e67b9f476 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_update.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_update.sh @@ -30,7 +30,7 @@ LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n") if [ -x "/bin/opkg" ]; then OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) elif [ -x "/usr/bin/apk" ]; then - OP_CV=$(apk list luci-app-openclash |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1) + OP_CV=$(apk list luci-app-openclash 2>/dev/null |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1apk list luci-app-openclash 2>/dev/null|grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1 |awk -F '.' '{print $2$3}' 2>/dev/null) fi OP_LV=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") @@ -156,10 +156,10 @@ if [ -x "/bin/opkg" ]; then SLOG_CLEAN fi elif [ -x "/usr/bin/apk" ]; then - if [ "$?" != "0" ] || [ -z "$(apk list luci-app-openclash |grep 'installed')" ]; then + if [ "$?" != "0" ] || [ -z "$(apk list luci-app-openclash 2>/dev/null |grep 'installed')" ]; then apk add --allow-untrusted /tmp/openclash.apk fi - if [ "$?" != "0" ] || [ -z "$(apk list luci-app-openclash |grep 'installed')" ]; then + if [ "$?" != "0" ] || [ -z "$(apk list luci-app-openclash 2>/dev/null |grep 'installed')" ]; then rm -rf /tmp/openclash.apk >/dev/null 2>&1 LOG_OUT "OpenClash Update Successful, About To Restart!" uci -q set openclash.config.enable=1 diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_version.sh b/luci-app-openclash/root/usr/share/openclash/openclash_version.sh index 028b166121..dfff174167 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_version.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_version.sh @@ -7,7 +7,7 @@ RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master") if [ -x "/bin/opkg" ]; then OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) elif [ -x "/usr/bin/apk" ]; then - OP_CV=$(apk list luci-app-openclash |grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1) + OP_CV=$(apk list luci-app-openclash 2>/dev/null|grep 'installed' | grep -oE '\d+(\.\d+)*' | head -1 |awk -F '.' '{print $2$3}' 2>/dev/null) fi OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0) diff --git a/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg b/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg index f8cfa888e3..0a2dd4f544 100644 --- a/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg +++ b/luci-app-openclash/root/www/luci-static/resources/openclash/img/version.svg @@ -1 +1 @@ -Current Version: v0.00.00Current Versionv0.00.00 \ No newline at end of file +Current Version: v0.00.00Current Versionv0.00.00 \ No newline at end of file