core: cygwin EOL 统一使用 cygwin-archive x86 源

This commit is contained in:
bin456789 2024-03-15 00:01:34 +08:00
parent bec14c13c1
commit 8b3ba5c7d3
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 39 additions and 22 deletions

View File

@ -53,28 +53,38 @@ set tags=%tmp%\cygwin-installed-!pkgs!
if not exist !tags! ( if not exist !tags! (
rem win10 arm 支持运行 x86 软件 rem win10 arm 支持运行 x86 软件
rem win11 arm 支持运行 x86 和 x86_64 软件 rem win11 arm 支持运行 x86 和 x86_64 软件
rem wmic os get osarchitecture rem wmic os get osarchitecture 显示中文
rem wmic ComputerSystem get SystemType 显示英文
for /f "tokens=2 delims==" %%a in ('wmic os get BuildNumber /format:list ^| find "BuildNumber"') do (
set /a BuildNumber=%%a
)
set CygwinEOL=1
wmic ComputerSystem get SystemType | find "ARM" > nul wmic ComputerSystem get SystemType | find "ARM" > nul
if not errorlevel 1 ( if not errorlevel 1 (
for /f "tokens=2 delims==" %%a in ('wmic os get BuildNumber /format:list ^| find "BuildNumber"') do set BuildNumber=%%a
if !BuildNumber! GEQ 22000 ( if !BuildNumber! GEQ 22000 (
set CygwinArch=x86_64 set CygwinEOL=0
) else (
set CygwinArch=x86
) )
) else ( ) else (
wmic ComputerSystem get SystemType | find "x64" > nul wmic ComputerSystem get SystemType | find "x64" > nul
if not errorlevel 1 ( if not errorlevel 1 (
set CygwinArch=x86_64 if !BuildNumber! GEQ 9600 (
) else ( set CygwinEOL=0
set CygwinArch=x86 )
) )
) )
if "!CygwinArch!" == "x86_64" ( rem win7/8 cygwin 已 EOL不能用最新 cygwin 源,而要用 Cygwin Time Machine 源
set dir=/sourceware/cygwin rem 但 Cygwin Time Machine 没有国内源
) else ( rem 为了保证国内下载速度, cygwin EOL 统一使用 cygwin-archive x86 源
if !CygwinEOL! == "1" (
set CygwinArch=x86
set dir=/sourceware/cygwin-archive/20221123 set dir=/sourceware/cygwin-archive/20221123
) else (
set CygwinArch=x86_64
set dir=/sourceware/cygwin
) )
rem 下载 Cygwin rem 下载 Cygwin

View File

@ -856,7 +856,7 @@ is_efi() {
is_secure_boot_enabled() { is_secure_boot_enabled() {
if is_efi; then if is_efi; then
if is_in_windows; then if is_in_windows; then
reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State' /v UEFISecureBootEnabled | grep 0x1 reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State' /v UEFISecureBootEnabled 2>/dev/null | grep 0x1
else else
# localhost:~# mokutil --sb-state # localhost:~# mokutil --sb-state
# SecureBoot disabled # SecureBoot disabled
@ -1497,9 +1497,25 @@ EOF
} }
# 脚本入口 # 脚本入口
if is_in_windows; then
# win系统盘
c=$(echo $SYSTEMDRIVE | cut -c1)
# 64位系统 + 32位cmd/cygwin需要添加 PATH否则找不到64位系统程序例如bcdedit
sysnative=$(cygpath -u $WINDIR\\Sysnative)
if [ -d $sysnative ]; then
PATH=$PATH:$sysnative
fi
# 更改 windows 命令输出语言为英文
# chcp.com 437 # 会清屏
mode.com con cp select=437 >/dev/null
fi
# 检查 root # 检查 root
if is_in_windows; then if is_in_windows; then
if ! openfiles >/dev/null 2>&1; then # 64位系统 + 32位cmd/cygwin运行 openfiles 报错:目标系统必须运行 32 位的操作系统
if ! fltmc >/dev/null 2>&1; then
error_and_exit "Please run as administrator." error_and_exit "Please run as administrator."
fi fi
else else
@ -1566,15 +1582,6 @@ if is_secure_boot_enabled; then
error_and_exit "Not Supported with secure boot enabled." error_and_exit "Not Supported with secure boot enabled."
fi fi
if is_in_windows; then
# win系统盘
c=$(echo $SYSTEMDRIVE | cut -c1)
# 更改 windows 命令输出语言为英文
# chcp.com 437 # 会清屏
mode.com con cp select=437 >/dev/null
fi
# 必备组件 # 必备组件
install_pkg curl grep install_pkg curl grep