mirror of
https://github.com/bin456789/reinstall.git
synced 2025-06-08 13:29:58 +00:00
core: 通过检查命令是否存在,判断 cygwin 是否成功安装
This commit is contained in:
parent
3ba76be1e6
commit
f60f79e65a
@ -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).
|
> Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console).
|
||||||
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `/trans.sh alpine`
|
> <br />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 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Rescue System (Live OS)
|
### Feature 3: Reboot to <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> 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.
|
- 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@@@`
|
- Username `root`, Default password `123@@@`
|
||||||
@ -254,7 +254,10 @@ bash reinstall.sh netboot.xyz
|
|||||||
- Hyper-V Server \*
|
- Hyper-V Server \*
|
||||||
- Azure Stack HCI \*
|
- 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.
|
- 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 <https://massgrave.dev/genuine-installation-media>, a site that collects monthly released ISOs, ensuring that the ISOs found by the script are the official latest versions.
|
- The script will search for ISOs from <https://massgrave.dev/genuine-installation-media>, a site that collects monthly released ISOs, ensuring that the ISOs found by the script are the official latest versions.
|
||||||
|
@ -210,7 +210,7 @@ bash reinstall.sh dd --img https://example.com/xxx.xz
|
|||||||
> 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
> 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
||||||
> <br />即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
|
> <br />即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
|
||||||
|
|
||||||
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Live OS(救援系统)
|
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Live OS(内存系统)
|
||||||
|
|
||||||
- 可用 ssh 连接,进行备份/恢复硬盘、手动 DD、修改分区、手动安装 Alpine/Arch/Gentoo 等操作
|
- 可用 ssh 连接,进行备份/恢复硬盘、手动 DD、修改分区、手动安装 Alpine/Arch/Gentoo 等操作
|
||||||
- 用户名 `root` 默认密码 `123@@@`
|
- 用户名 `root` 默认密码 `123@@@`
|
||||||
@ -254,7 +254,10 @@ bash reinstall.sh netboot.xyz
|
|||||||
- Hyper-V Server \*
|
- Hyper-V Server \*
|
||||||
- Azure Stack HCI \*
|
- Azure Stack HCI \*
|
||||||
|
|
||||||
#### 方法 1: 让脚本自动查找 ISO (推荐)
|
#### ~~方法 1: 让脚本自动查找 ISO~~
|
||||||
|
|
||||||
|
> [!CAUTION]
|
||||||
|
> 目前该 ISO 仓库禁止了直链下载,因此该方法已失效
|
||||||
|
|
||||||
- 通常情况下 Windows 每个月都会发布新的官方 ISO,集成了最新的系统补丁,避免了刚安装好系统就要下载一堆补丁
|
- 通常情况下 Windows 每个月都会发布新的官方 ISO,集成了最新的系统补丁,避免了刚安装好系统就要下载一堆补丁
|
||||||
- 脚本会从 <https://massgrave.dev/genuine-installation-media> 查找 ISO,该网站收录了每月发布的 ISO,因此脚本查找到的 ISO 都是官方最新版
|
- 脚本会从 <https://massgrave.dev/genuine-installation-media> 查找 ISO,该网站收录了每月发布的 ISO,因此脚本查找到的 ISO 都是官方最新版
|
||||||
|
@ -6,6 +6,9 @@ set confhome=https://raw.githubusercontent.com/bin456789/reinstall/main
|
|||||||
set confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/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
|
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 65001 代码页会乱码
|
||||||
|
|
||||||
rem 不要用 :: 注释
|
rem 不要用 :: 注释
|
||||||
@ -54,10 +57,7 @@ if not errorlevel 1 (
|
|||||||
set mirror=http://mirrors.kernel.org
|
set mirror=http://mirrors.kernel.org
|
||||||
)
|
)
|
||||||
|
|
||||||
rem pkgs 改动了才重新运行 Cygwin 安装程序
|
call :check_cygwin_installed || (
|
||||||
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%" (
|
|
||||||
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 显示中文
|
||||||
@ -122,14 +122,15 @@ if not exist "%tags%" (
|
|||||||
--only-site ^
|
--only-site ^
|
||||||
--site !site! ^
|
--site !site! ^
|
||||||
--root %SystemDrive%\cygwin ^
|
--root %SystemDrive%\cygwin ^
|
||||||
--local-package-dir %tmp%\cygwin-local-package-dir ^
|
--local-package-dir %~dp0cygwin-local-package-dir ^
|
||||||
--packages %pkgs% ^
|
--packages %pkgs%
|
||||||
&& type nul >"%tags%"
|
|
||||||
|
|
||||||
if errorlevel 1 (
|
rem 检查 Cygwin 是否成功安装
|
||||||
echo "Failed to install Cygwin."
|
if errorlevel 1 (
|
||||||
exit /b 1
|
goto :install_cygwin_failed
|
||||||
)
|
) else (
|
||||||
|
call :check_cygwin_installed || goto :install_cygwin_failed
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
rem 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c,因此末尾要有 /
|
rem 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c,因此末尾要有 /
|
||||||
@ -189,3 +190,17 @@ exit /b
|
|||||||
:download_failed
|
:download_failed
|
||||||
echo Download failed.
|
echo Download failed.
|
||||||
exit /b 1
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user