diff --git a/README.md b/README.md index d03e6c7..d6ab884 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ bash reinstall.sh windows \ ### DD -```bash -bash reinstall.sh dd --img=https://example.com/xxx.xz -``` - 支持 gzip、xz 格式 支持自动配置静态 IP、扩展系统盘 +```bash +bash reinstall.sh dd --img=https://example.com/xxx.xz +``` + ### 重启到 Alpine 救援系统(不运行重装) 可用 ssh 连接,进行手动 DD、修改分区等操作 @@ -76,16 +76,40 @@ bash reinstall.sh alpine --hold=1 ## Windows 下使用 -下载(链接另存为)放到同一目录 +管理员权限打开 `cmd` 窗口 - +如果打开的是 `powershell` 窗口,先进入 `cmd` - +### 下载 -管理员权限打开 `cmd` / `powershell` 窗口,先运行 `cmd`(重要),再运行: +```batch +certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat +``` -```bat -reinstall.bat centos-7 (或其他操作,所有功能均可在 Windows 下使用) +### 下载(国内) + +```batch +certutil -urlcache -f -split https://ghps.cc/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat +``` + +### 如果无法下载 + +- 关闭 Windows Defender 实时保护 + +- 系统的 SSL 根证书没更新 + + 可用`链接另存为`,或者`远程桌面`复制以下两个文件 + + + + + +### 使用 + +可将 centos-7 换成其他,所有功能均可在 Windows 下使用 + +```batch +reinstall.bat centos-7 ``` ## Windows iso 安装 diff --git a/reinstall.bat b/reinstall.bat index 4da42be..e01248d 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -12,26 +12,33 @@ cd /d %~dp0 :: 检查是否有管理员权限 openfiles 1>nul 2>&1 if not !errorlevel! == 0 ( - echo "Please run as administrator!" + echo Please run as administrator^^! exit 1 ) +:: 检查是否国内 +if not exist %tmp%\geoip ( + call :download https://www.cloudflare.com/cdn-cgi/trace %tmp%\geoip +) +findstr /c:"loc=CN" %tmp%\geoip >nul +if !errorlevel! == 0 ( + set mirror=http://mirror.nju.edu.cn + + echo !confhome! | findstr /c:"://raw.githubusercontent.com/" >nul + if !errorlevel! == 0 ( + set confhome=https://ghps.cc/!confhome! + ) +) else ( + set mirror=http://mirrors.kernel.org +) + + :: pkgs 改动了才重新运行 Cygwin 安装程序 set pkgs="curl,cpio,p7zip,bind-utils,ipcalc" set tags=%tmp%\cygwin-installed-!pkgs! if not exist !tags! ( - :: 检查是否国内 - :: 在括号里面,:: 下一行不能是空行!!!!! - call :download http://www.cloudflare.com/cdn-cgi/trace %tmp%\geoip "Check Location" - findstr "loc=CN" %tmp%\geoip >nul - if !errorlevel! == 0 ( - set host=http://mirror.nju.edu.cn - ) else ( - set host=http://mirrors.kernel.org - ) - :: 检查32/64位 - wmic os get osarchitecture | findstr 64 >nul + wmic os get osarchitecture | findstr /c:"64" >nul if !errorlevel! == 0 ( set arch=x86_64 set dir=/sourceware/cygwin @@ -44,7 +51,7 @@ if not exist !tags! ( call :download http://www.cygwin.com/setup-!arch!.exe %tmp%\setup-cygwin.exe "Download Cygwin" :: 安装 Cygwin - set site=!host!!dir! + set site=!mirror!!dir! %tmp%\setup-cygwin.exe --allow-unsupported-windows^ --quiet-mode^ --only-site^