fix getenv diagnostics robustness
This commit is contained in:
parent
2f177ace71
commit
a48a5246a0
|
|
@ -0,0 +1,12 @@
|
||||||
|
# AI Modification Log: Getenv Robustness
|
||||||
|
|
||||||
|
Date: 2026-06-29
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
- Fixed `Get_Release_Info` so it prints the kernel patch version instead of executing grep output as a command.
|
||||||
|
- Added timeouts and failure tolerance to external IP lookup calls in `Get_Action_Info`.
|
||||||
|
|
||||||
|
## Reason
|
||||||
|
|
||||||
|
The old backtick command substitution could try to execute the matched `KERNEL_PATCHVER:=...` line. The IP lookup is only diagnostic, so it should not block or fail the build when the external services are unavailable.
|
||||||
|
|
@ -15,16 +15,16 @@ df -h
|
||||||
|
|
||||||
# Get IP Info
|
# Get IP Info
|
||||||
echo "------------------------------- IP Address Info ------------------------------"
|
echo "------------------------------- IP Address Info ------------------------------"
|
||||||
IP=`curl ip.115115.xyz -s`
|
IP="$(curl --connect-timeout 5 --max-time 10 -fsS ip.115115.xyz 2>/dev/null || true)"
|
||||||
curl ip.115115.xyz -s
|
printf "%s\n" "${IP}"
|
||||||
# curl -s https://searchplugin.csdn.net/api/v1/ip/get?ip=${IP} | jq -r .data.address
|
# curl -s https://searchplugin.csdn.net/api/v1/ip/get?ip=${IP} | jq -r .data.address
|
||||||
curl -s https://api.vore.top/api/IPdata?ip=${IP} | jq -r .adcode.o
|
[ -n "${IP}" ] && curl --connect-timeout 5 --max-time 10 -fsS "https://api.vore.top/api/IPdata?ip=${IP}" 2>/dev/null | jq -r .adcode.o || true
|
||||||
}
|
}
|
||||||
|
|
||||||
Get_Release_Info() {
|
Get_Release_Info() {
|
||||||
echo "------------------------------- Build Version Data ----------------------------"
|
echo "------------------------------- Build Version Data ----------------------------"
|
||||||
echo ${NOW_DATA_VERSION}
|
echo ${NOW_DATA_VERSION}
|
||||||
echo "------------------------------ Build Kernel Version ---------------------------"
|
echo "------------------------------ Build Kernel Version ---------------------------"
|
||||||
`cat ${OPENWRT_BUILD_DIR}/target/linux/x86/Makefile | grep KERNEL_PATCHVER:=`
|
grep "KERNEL_PATCHVER:=" "${OPENWRT_BUILD_DIR}/target/linux/x86/Makefile"
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue