diff --git a/README.en.md b/README.en.md index fa5fd78..c33145a 100644 --- a/README.en.md +++ b/README.en.md @@ -210,7 +210,7 @@ bash reinstall.sh dd --img https://example.com/xxx.xz > Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console). >
Even if errors occur during the installation process, you can still install to Alpine via SSH by running `/trans.sh alpine` -### Feature 3: Reboot to Alpine Rescue System (Live OS) +### Feature 3: Reboot to Alpine Live OS (RAM OS) - You can use SSH to backup/restore disk, manually perform DD operations, modify partitions, and manually install Alpine, Arch, Gentoo, and other systems. - Username `root`, Default password `123@@@` @@ -254,7 +254,10 @@ bash reinstall.sh netboot.xyz - Hyper-V Server \* - Azure Stack HCI \* -#### Method 1: Let the Script Automatically Search for ISO (Recommended) +#### ~~Method 1: Let the Script Automatically Search for ISO (Recommended)~~ + +> [!CAUTION] +> The ISO repository currently prohibits direct link downloads, so this method is no longer effective. - Typically, Windows releases new official ISOs every month, which integrate the latest system patches, avoiding the need to download a bunch of updates right after installation. - The script will search for ISOs from , a site that collects monthly released ISOs, ensuring that the ISOs found by the script are the official latest versions. diff --git a/README.md b/README.md index a71a747..823bdf3 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ bash reinstall.sh dd --img https://example.com/xxx.xz > 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 >
即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。 -### 功能 3: 重启到 Alpine Live OS(救援系统) +### 功能 3: 重启到 Alpine Live OS(内存系统) - 可用 ssh 连接,进行备份/恢复硬盘、手动 DD、修改分区、手动安装 Alpine/Arch/Gentoo 等操作 - 用户名 `root` 默认密码 `123@@@` @@ -254,7 +254,10 @@ bash reinstall.sh netboot.xyz - Hyper-V Server \* - Azure Stack HCI \* -#### 方法 1: 让脚本自动查找 ISO (推荐) +#### ~~方法 1: 让脚本自动查找 ISO~~ + +> [!CAUTION] +> 目前该 ISO 仓库禁止了直链下载,因此该方法已失效 - 通常情况下 Windows 每个月都会发布新的官方 ISO,集成了最新的系统补丁,避免了刚安装好系统就要下载一堆补丁 - 脚本会从 查找 ISO,该网站收录了每月发布的 ISO,因此脚本查找到的 ISO 都是官方最新版 diff --git a/reinstall.bat b/reinstall.bat index fdd13d0..b5a447e 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -6,6 +6,9 @@ set confhome=https://raw.githubusercontent.com/bin456789/reinstall/main set confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main rem set confhome_cn=https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main +set pkgs=curl,cpio,p7zip,ipcalc,dos2unix,jq,xz,gzip,zstd,openssl,bind-utils,libiconv,binutils +set cmds=curl,cpio,p7zip,ipcalc,dos2unix,jq,xz,gzip,zstd,openssl,nslookup,iconv,ar + rem 65001 代码页会乱码 rem 不要用 :: 注释 @@ -54,10 +57,7 @@ if not errorlevel 1 ( set mirror=http://mirrors.kernel.org ) -rem pkgs 改动了才重新运行 Cygwin 安装程序 -set pkgs=curl,cpio,p7zip,bind-utils,ipcalc,dos2unix,binutils,jq,xz,gzip,zstd,openssl,libiconv -set tags=%tmp%\cygwin-installed-%pkgs% -if not exist "%tags%" ( +call :check_cygwin_installed || ( rem win10 arm 支持运行 x86 软件 rem win11 arm 支持运行 x86 和 x86_64 软件 rem wmic os get osarchitecture 显示中文 @@ -122,14 +122,15 @@ if not exist "%tags%" ( --only-site ^ --site !site! ^ --root %SystemDrive%\cygwin ^ - --local-package-dir %tmp%\cygwin-local-package-dir ^ - --packages %pkgs% ^ - && type nul >"%tags%" + --local-package-dir %~dp0cygwin-local-package-dir ^ + --packages %pkgs% - if errorlevel 1 ( - echo "Failed to install Cygwin." - exit /b 1 - ) + rem 检查 Cygwin 是否成功安装 + if errorlevel 1 ( + goto :install_cygwin_failed + ) else ( + call :check_cygwin_installed || goto :install_cygwin_failed + ) ) rem 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c,因此末尾要有 / @@ -189,3 +190,17 @@ exit /b :download_failed echo Download failed. exit /b 1 + +:install_cygwin_failed +echo Failed to install Cygwin. +exit /b 1 + +:check_cygwin_installed +set "cmds_space=%cmds:,= %" +for %%c in (%cmds_space%) do ( + if not exist "%SystemDrive%\cygwin\bin\%%c" if not exist "%SystemDrive%\cygwin\bin\%%c.exe" ( + echo %%c not found. + exit /b 1 + ) +) +exit /b 0