diff --git a/luci-app-openclash/root/usr/share/openclash/clash_version.sh b/luci-app-openclash/root/usr/share/openclash/clash_version.sh index a4a2d3370f..b1f62eaf5a 100644 --- a/luci-app-openclash/root/usr/share/openclash/clash_version.sh +++ b/luci-app-openclash/root/usr/share/openclash/clash_version.sh @@ -31,14 +31,7 @@ if [ "$TIME" != "$CHTIME" ]; then curl -SsL -m 60 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '')" ]; then - curl -SsL -m 60 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core_version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - curl_status=${PIPESTATUS[0]} - else - curl_status=0 - fi - - if [ "$curl_status" -ne 0 ] ; then + if [ "${PIPESTATUS[0]}" -ne 0 ]; then rm -rf $LAST_OPVER fi fi diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_core.sh b/luci-app-openclash/root/usr/share/openclash/openclash_core.sh index 4aa4fe191f..0bae43d1b5 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_core.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_core.sh @@ -71,13 +71,8 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne 0 ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_tun.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - curl_status=${PIPESTATUS[0]} - else - curl_status=0 - fi - if [ "$curl_status" -eq 0 ]; then + + if [ "${PIPESTATUS[0]}" -eq 0 ]; then gzip -t /tmp/clash_tun.gz >/dev/null 2>&1 fi ;; @@ -94,13 +89,8 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne 0 ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash_meta.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - curl_status=${PIPESTATUS[0]} - else - curl_status=0 - fi - if [ "$curl_status" -eq 0 ]; then + + if [ "${PIPESTATUS[0]}" -eq 0 ]; then gzip -t /tmp/clash_meta.tar.gz >/dev/null 2>&1 fi ;; @@ -117,13 +107,8 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/core/"$RELEASE_BRANCH"/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne 0 ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/clash.tar.gz" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - curl_status=${PIPESTATUS[0]} - else - curl_status=0 - fi - if [ "$curl_status" -eq 0 ]; then + + if [ "${PIPESTATUS[0]}" -eq 0 ]; then gzip -t /tmp/clash.tar.gz >/dev/null 2>&1 fi esac diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_geoip.sh b/luci-app-openclash/root/usr/share/openclash/openclash_geoip.sh index c0919f5585..6cd11f011e 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_geoip.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_geoip.sh @@ -39,9 +39,6 @@ else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne "0" ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geoip.dat" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - fi else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$GEOIP_CUSTOM_URL" -o /tmp/GeoIP.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoIP.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_geosite.sh b/luci-app-openclash/root/usr/share/openclash/openclash_geosite.sh index 2587e36aa7..f220fc3cc1 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_geosite.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_geosite.sh @@ -39,9 +39,6 @@ else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne "0" ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/v/v2/v2raya/dists/v2ray-rules-dat/geosite.dat" -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - fi else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 "$GEOSITE_CUSTOM_URL" -o /tmp/GeoSite.dat 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/GeoSite.dat" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi 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 baf2f2ce9c..0bd1f04f3a 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_update.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_update.sh @@ -58,13 +58,8 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 else curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne 0 ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="/tmp/openclash.ipk" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - curl_status=${PIPESTATUS[0]} - else - curl_status=0 - fi - if [ "$curl_status" -eq 0 ] && [ -s "/tmp/openclash.ipk" ]; then + + if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -s "/tmp/openclash.ipk" ]; then LOG_OUT "【OpenClash - v$LAST_VER】Download Successful, Start Pre Update Test..." if [ -z "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then 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 d9bcbfd7d5..d4f9690ed1 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_version.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash_version.sh @@ -22,14 +22,7 @@ if [ "$TIME" != "$CHTIME" ]; then curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://raw.githubusercontent.com/vernesong/OpenClash/package/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" fi - if [ "${PIPESTATUS[0]}" -ne 0 ] || [ -n "$(cat $LAST_OPVER |grep '')" ]; then - curl -SsL --connect-timeout 30 -m 60 --speed-time 30 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/version -o $LAST_OPVER 2>&1 | awk -v time="$(date "+%Y-%m-%d %H:%M:%S")" -v file="$LAST_OPVER" '{print time "【" file "】Download Failed:【"$0"】"}' >> "$LOG_FILE" - curl_status=${PIPESTATUS[0]} - else - curl_status=0 - fi - - if [ "$curl_status" -eq 0 ] && [ -z "$(cat $LAST_OPVER |grep '')" ]; then + if [ "${PIPESTATUS[0]}" -eq 0 ] && [ -z "$(cat $LAST_OPVER |grep '')" ]; then OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null) if [ "$(expr "$OP_CV" \>= "$OP_LV")" = "1" ]; then sed -i '/^https:/,$d' $LAST_OPVER