mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-18 20:39:14 +08:00
core: 在 windows 下也使用国内代理下载 sh 脚本
This commit is contained in:
parent
20866ef84b
commit
c8ac22c65e
44
README.md
44
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` 窗口
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
||||
如果打开的是 `powershell` 窗口,先进入 `cmd`
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
||||
### 下载
|
||||
|
||||
管理员权限打开 `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 根证书没更新
|
||||
|
||||
可用`链接另存为`,或者`远程桌面`复制以下两个文件
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
||||
|
||||
### 使用
|
||||
|
||||
可将 centos-7 换成其他,所有功能均可在 Windows 下使用
|
||||
|
||||
```batch
|
||||
reinstall.bat centos-7
|
||||
```
|
||||
|
||||
## Windows iso 安装
|
||||
|
@ -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^
|
||||
|
Loading…
x
Reference in New Issue
Block a user