core: 修复 cygwin 下无法获得内存大小
Some checks are pending
运行主程序 / 运行主程序 (./reinstall.bat --debug --password 123@@@, windows-latest) (push) Waiting to run
运行主程序 / 运行主程序 (sudo bash reinstall.sh --debug --password 123@@@, ubuntu-latest) (push) Waiting to run
同步到 CNB / 同步到 CNB (push) Waiting to run

cygwin 要装 procps-ng 才有 free 命令
This commit is contained in:
bin456789 2025-04-15 17:30:35 +08:00
parent 6b35479515
commit 0b2eed1750
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -2093,9 +2093,10 @@ check_ram() {
fi
# 用于兜底,不太准确
# cygwin 要装 procps-ng 才有 free 命令
if [ -z $ram_size ]; then
ram_size=$(free -m | grep ^Mem: | awk '{print $2}')
ram_size=$((ram_size + 64 + 4))
ram_size_k=$(grep '^MemTotal:' /proc/meminfo | awk '{print $2}')
ram_size=$((ram_size_k / 1024 + 64 + 4))
fi
if [ -z $ram_size ] || [ $ram_size -le 0 ]; then