mirror of
https://github.com/xopenwrt/X-OpenWrt-New.git
synced 2026-09-18 08:20:11 +00:00
优化代码
This commit is contained in:
@@ -8,11 +8,11 @@ GET_TARGET_INFO() {
|
||||
Home="${GITHUB_WORKSPACE}/openwrt"
|
||||
[ -f "${GITHUB_WORKSPACE}/Openwrt.info" ] && . ${GITHUB_WORKSPACE}/Openwrt.info
|
||||
[[ "${Short_Firmware_Date}" == true ]] && Compile_Date="$(echo ${Compile_Date} | cut -c1-8)"
|
||||
User_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${GITHUB_WORKSPACE}/.git/config | cut -c8-100)"
|
||||
User_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${GITHUB_WORKSPACE}/.git/config | cut -c8-100 | sed 's/^[ \t]*//g')"
|
||||
[[ -z "${Author}" ]] && {
|
||||
Author="$(echo "${User_Repo}" | egrep -o "[a-zA-Z0-9]+" | awk 'NR==4')"
|
||||
}
|
||||
Openwrt_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${Home}/.git/config | cut -c8-100)"
|
||||
Openwrt_Repo="$(grep "https://github.com/[a-zA-Z0-9]" ${Home}/.git/config | cut -c8-100 | sed 's/^[ \t]*//g')"
|
||||
Openwrt_Author="$(echo "${Openwrt_Repo}" | egrep -o "[a-zA-Z0-9]+" | awk 'NR==4')"
|
||||
Current_Branch="$(git branch | sed 's/* //g' | sed 's/^[ \t]*//g')"
|
||||
In_Firmware_Info=package/base-files/files/etc/openwrt_info
|
||||
@@ -75,9 +75,9 @@ GET_TARGET_INFO() {
|
||||
echo "TARGET_SUBTARGET=${TARGET_SUBTARGET}" >> ${Home}/TARGET_INFO
|
||||
echo "Home=${Home}" >> ${Home}/TARGET_INFO
|
||||
echo "Current_Branch=${Current_Branch}" >> ${Home}/TARGET_INFO
|
||||
|
||||
echo "CURRENT_Version=${Openwrt_Version}" > ${In_Firmware_Info}
|
||||
echo "Github=${User_Repo}" >> ${In_Firmware_Info}
|
||||
|
||||
echo "Github=${User_Repo}" > ${In_Firmware_Info}
|
||||
echo "CURRENT_Version=${Openwrt_Version}" >> ${In_Firmware_Info}
|
||||
echo "DEFAULT_Device=${TARGET_PROFILE}" >> ${In_Firmware_Info}
|
||||
echo "Firmware_Type=${Firmware_Type}" >> ${In_Firmware_Info}
|
||||
|
||||
|
||||
+11
-9
@@ -3,7 +3,7 @@
|
||||
# AutoBuild Module by Hyy2001
|
||||
# AutoUpdate for Openwrt
|
||||
|
||||
Version=V5.7.2
|
||||
Version=V5.7.3
|
||||
|
||||
Shell_Helper() {
|
||||
cat <<EOF
|
||||
@@ -237,15 +237,17 @@ else
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [[ "$(cat /tmp/Package_list)" =~ "curl" ]];then
|
||||
Google_Check=$(curl -I -s --connect-timeout 3 google.com -w %{http_code} | tail -n1)
|
||||
[[ ! "$Google_Check" == 301 ]] && {
|
||||
TIME && echo "Google 连接失败,尝试使用 [FastGit] 镜像加速!"
|
||||
if [ -z "${PROXY_Release}" ];then
|
||||
if [[ "$(cat /tmp/Package_list)" =~ "curl" ]];then
|
||||
Google_Check=$(curl -I -s --connect-timeout 3 google.com -w %{http_code} | tail -n1)
|
||||
[[ ! "$Google_Check" == 301 ]] && {
|
||||
TIME && echo "Google 连接失败,尝试使用 [FastGit] 镜像加速!"
|
||||
PROXY_Release="${_PROXY_Release}"
|
||||
}
|
||||
else
|
||||
TIME && echo "无法确定网络环境,默认开启 [FastGit] 镜像加速!"
|
||||
PROXY_Release="${_PROXY_Release}"
|
||||
}
|
||||
else
|
||||
TIME && echo "无法确定网络环境,默认使用 [FastGit] 镜像加速!"
|
||||
PROXY_Release="${_PROXY_Release}"
|
||||
fi
|
||||
fi
|
||||
[[ "${TMP_Available}" -lt "${Space_Min}" ]] && {
|
||||
TIME && echo "/tmp 空间不足: [${Space_Min}M],无法执行更新!"
|
||||
|
||||
Reference in New Issue
Block a user