Compare commits

...

9 Commits

Author SHA1 Message Date
bin456789
ce8a315a2e el: 修复 almalinux 9 链接 404
fixes #436
2025-09-21 15:27:17 +08:00
bin456789
cf6b4c226d docs: 更新文档 2025-09-16 00:24:09 +08:00
bin456789
b098c0cabd windows: 更新 intel nic 驱动 2025-09-15 23:49:05 +08:00
bin456789
2a0690a395 windows: 更新 iso 链接 2025-09-09 22:46:31 +08:00
bin456789
30a3616bf8 net: 修复 accept_ra 被关闭导致 scaleway 在安装阶段默认路由过期而断网
fixes #423
2025-09-07 00:58:02 +08:00
bin456789
df2bda09dc windows: 修复链接变动导致无法自动查找 windows server 镜像 2025-09-03 19:36:09 +08:00
bin456789
38a5cc3940 opencloudos: 修复镜像链接变动导致 404 2025-09-03 19:36:08 +08:00
bin456789
c7e156dae4 windows: intel nic for win8 驱动使用 27.8 版本 2025-09-03 19:36:08 +08:00
bin456789
edcefc3e8c windows: 修复链接变动导致 2012/2012r2 intel nic 驱动 404
之前用的版本更新的驱动已被删除,原因不明
https://web.archive.org/web/20250702222809/https://www.intel.com/content/www/us/en/download/17480/intel-network-adapter-driver-for-windows-server-2012-r2.html
2025-09-03 19:36:07 +08:00
6 changed files with 260 additions and 118 deletions

View File

@@ -7,10 +7,13 @@ assignees: ''
---
原来的系统
要安装的系统:
遇到的问题:截图或者登录 SSH 获取日志 /reinstall.log
原来的系统 (Original system):
Original system:
System to be installed:
Issues encountered: Screenshot or log in via SSH to get the logs from /reinstall.log
要安装的系统 (System to be installed):
遇到的问题 (Issue):
<!--
请上传截图或者报错内容,注意删除 IP 地址和密码
(Please Upload Screenshot or error message. Be sure to delete the IP address and password)
-->

View File

@@ -5,24 +5,39 @@
[![Codacy](https://img.shields.io/codacy/grade/dc679a17751448628fe6d8ac35e26eed?logo=Codacy&label=Codacy&style=flat-square)](https://app.codacy.com/gh/bin456789/reinstall/dashboard)
[![CodeFactor](https://img.shields.io/codefactor/grade/github/bin456789/reinstall?logo=CodeFactor&logoColor=white&label=CodeFactor&style=flat-square)](https://www.codefactor.io/repository/github/bin456789/reinstall)
[![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&label=Lines%20of%20Code&style=flat-square)](https://github.com/XAMPPRocky/tokei_rs)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=flat-square&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
[![Github Sponsors](https://img.shields.io/badge/sponsor-30363D?style=flat-square&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789)
One-Click Script to Reinstall System [中文](README.md)
One-Click system reinstallation script for VPS [中文](README.md)
[![Sponsors](https://raw.githubusercontent.com/bin456789/sponsors/refs/heads/master/sponsors.svg)](https://github.com/sponsors/bin456789)
## Introduction
## Highlights
- One-click Linux installation: Supports 19 common distributions.
- One-click Windows installation: Uses the official ISO for installation instead of custom images. The script can automatically retrieves the ISO link and installs common drivers like `Virtio`.
- Supports installation in any direction, i.e., `Linux to Linux`, `Linux to Windows`, `Windows to Windows`, `Windows to Linux`
- No need to input IP parameters; automatically recognizes dynamic and static IPs, supports `/32`, `/128`, `gateway outside subnet`, `IPv6 only`, `dual NIC`
- One-click reinstallation to Linux: Supports 19 common distributions.
- One-click reinstallation to Windows: Uses the official original ISO instead of custom images. The script can automatically fetch the ISO link and installs public cloud drivers like `VirtIO`.
- Supports reinstallation in any direction, i.e., `Linux to Linux`, `Linux to Windows`, `Windows to Windows`, `Windows to Linux`
- Automatically configures IP and intelligently sets it as static or dynamic. Supports `/32`, `/128`, `gateway outside subnet`, `IPv6 only`, `IPv4/IPv6 on different NIC`
- Specially optimized for low-spec servers, requires less memory than the official netboot
- Uses partition table ID to identify hard drives throughout the process, ensuring no wrong disk is written
- Supports BIOS and EFI boot, and ARM Server
- No homemades image included, all resources are obtained in real-time from mirror sites
If this helped you, you can buy me a milk tea.
[![Donate](https://img.shields.io/badge/Donate-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789)
[![Sponsors](https://raw.githubusercontent.com/bin456789/sponsors/refs/heads/master/sponsors.svg)](https://github.com/sponsors/bin456789)
### Feedback
[![GitHub Issues](https://img.shields.io/badge/GitHub-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bin456789/reinstall/issues)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
## Quick Start
- [Download](#download-current-system-is--linux)
- [Feature 1. One-click reinstallation to Linux](#feature-1-install--linux)
- [Feature 2. One-click DD Raw image to hard disk](#feature-2-dd-raw-image-to-hard-disk)
- [Feature 3. One-click reboot to Alpine Live OS in-memory system](#feature-3-reboot-to--alpine-live-os-ram-os)
- [Feature 4. One-click reboot to netboot.xyz](#feature-4-reboot-to--netbootxyz)
- [Feature 5. One-click reinstallation to Windows](#feature-5-install--windows-iso)
## System Requirements
The original system can be any system listed in the table.
@@ -56,6 +71,13 @@ The system requirements for the target system are as follows:
^ Indicates requiring either 256 MB memory + 1.5 GB disk, or 512 MB memory + 1 GB disk
> [!WARNING]
>
> In theory it also supports dedicated servers and PCs
>
> but if you can use IPMI or a USB drive, this script is not recommended.
> [!WARNING]
>
> ❌ This script does not support OpenVZ or LXC virtual machines.
>
> Please use <https://github.com/LloydAsp/OsMutation> instead.
@@ -65,13 +87,13 @@ The system requirements for the target system are as follows:
For server outside China:
```bash
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O ${_##*/} $_
```
For server inside China:
```bash
curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O reinstall.sh $_
curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O ${_##*/} $_
```
## Download (Current system is <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows)
@@ -117,6 +139,12 @@ certutil -urlcache -f -split https://cnb.cool/bin456789/reinstall/-/git/raw/main
### Feature 1: Install <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux
> [!CAUTION]
>
> This feature will erase **the entire hard disk** of the current system (including other partitions)!
>
> Data is priceless — please think twice before proceeding!
- The username is `root` with a default password of `123@@@`.
- When installing the latest version, the version number does not need to be specified.
- Maximizes disk space usage: no boot partition (except for Fedora) and no swap partition.
@@ -149,17 +177,9 @@ bash reinstall.sh anolis 7|8|23
#### Optional Parameters
- `--password PASSWORD` Set the password
- `--ssh-key KEY` Set up SSH login public key, supports these formats. When using public key, password is empty.
- `--ssh-key "ssh-rsa ..."`
- `--ssh-key "ssh-ed25519 ..."`
- `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."`
- `--ssh-key http://path/to/public_key`
- `--ssh-key github:your_username`
- `--ssh-key gitlab:your_username`
- `--ssh-key /path/to/public_key`
- `--ssh-key C:\path\to\public_key`
- `--ssh-key KEY` Set up SSH login public key, [formatted as follows](#--ssh-key). When using public key, password is empty.
- `--ssh-port PORT` Change the SSH port (for log observation during installation and for the new system)
- `--web-port PORT` Change the Web port (for log observation during installation)
- `--web-port PORT` Change the Web port (for log observation during installation only)
- `--frpc-toml /path/to/frpc.toml` Add frpc for intranet tunneling
- `--hold 2` Prevent reboot after installation completes, allowing SSH login to modify system content; the system is mounted at `/os` (this feature is not supported on Debian/Kali).
@@ -201,7 +221,13 @@ bash reinstall.sh ubuntu --installer
</details>
### Feature 2: DD
### Feature 2: DD RAW image to hard disk
> [!CAUTION]
>
> This feature will erase **the entire hard disk** of the current system (including other partitions)!
>
> Data is priceless — please think twice before proceeding!
- Supports `raw` and `vhd` image formats (either uncompressed or compressed as `.gz`, `.xz`, `.zst`, `.tar`, `.tar.gz`, `.tar.xz`, `.tar.zst`).
- When deploy a Windows image, the system disk will be automatically expanded, and machines with a static IP will have their IP configured, and may take a few minutes after the first boot for the configuration to take effect.
@@ -226,9 +252,14 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz"
### 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, partition modifications, manual Alpine installation, and other operations.
- Username `root`, Default password `123@@@`
- If manual operations do not damage the original system, rebooting will return to the original system.
> [!TIP]
>
> Although the script being run is `reinstall`, this feature **does not** delete any data or perform an automatic reinstallation; manual user operation is required.
> If the user does not damage the original system during manual operation, rebooting will return to the original system.
```bash
bash reinstall.sh alpine --hold=1
@@ -238,21 +269,18 @@ bash reinstall.sh alpine --hold=1
- `--password PASSWORD` Set password
- `--ssh-port PORT` Change SSH port
- `--ssh-key KEY` Set up SSH login public key, supports these formats. When using public key, password is empty.
- `--ssh-key "ssh-rsa ..."`
- `--ssh-key "ssh-ed25519 ..."`
- `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."`
- `--ssh-key http://path/to/public_key`
- `--ssh-key github:your_username`
- `--ssh-key gitlab:your_username`
- `--ssh-key /path/to/public_key`
- `--ssh-key C:\path\to\public_key`
- `--ssh-key KEY` Set up SSH login public key, [formatted as follows](#--ssh-key). When using public key, password is empty.
- `--frpc-toml /path/to/frpc.toml` Add frpc for intranet tunneling
### Feature 4: Reboot to <img width="16" height="16" src="https://netboot.xyz/img/favicon.ico" /> netboot.xyz
- Can manually install [more systems](https://github.com/netbootxyz/netboot.xyz?tab=readme-ov-file#what-operating-systems-are-currently-available-on-netbootxyz) using vendor backend VNC.
- If manual operations do not damage the original system, rebooting will return to the original system.
> [!TIP]
>
> Although the script being run is `reinstall`, this feature **does not** delete any data or perform an automatic reinstallation; manual user operation is required.
> If the user does not damage the original system during manual operation, rebooting will return to the original system.
```bash
bash reinstall.sh netboot.xyz
@@ -264,6 +292,12 @@ bash reinstall.sh netboot.xyz
![Windows Installation](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)
> [!CAUTION]
>
> This feature will erase **the entire hard disk** of the current system (including other partitions)!
>
> Data is priceless — please think twice before proceeding!
- Username `administrator`, Default password `123@@@`
- If remote login fails, try using the username `.\administrator`.
- The machine with a static IP will automatically configure the IP. It may take a few minutes to take effect on the first boot.
@@ -276,7 +310,7 @@ bash reinstall.sh netboot.xyz
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
- Azure Local (Azure Stack HCI) \*
#### Method 1: Let the Script Automatically Search for ISO
@@ -386,18 +420,18 @@ bash reinstall.sh windows \
- `--password PASSWORD` Set Password
- `--allow-ping` Configure Windows Firewall to Allow Ping Responses
- `--rdp-port PORT` Change RDP port
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--ssh-port PORT` Change SSH port (for log observation during installation only)
- `--web-port PORT` Change Web port (for log observation during installation only)
- `--add-driver INF_OR_DIR` Add additional driver, specifying .inf path, or the folder contains .inf file.
- The driver must be downloaded locally first.
- The driver must be downloaded to current system first.
- This parameter can be set multiple times to add different driver.
- `--frpc-toml /path/to/frpc.toml` Add frpc for intranet tunneling
- `--hold 2` Allow SSH connections for modifying the disk content before rebooting into the official Windows installation program, with the disk mounted at `/os`.
#### The following drivers will automatic download and install as needed, without the need for manual addition
- Virtio ([Virtio][virtio-virtio], [Alibaba Cloud][virtio-aliyun], [Tencent Cloud][virtio-qcloud], [GCP][virtio-gcp])
- XEN ([~~XEN~~][xen-xen] (unsigned), [Citrix][xen-citrix], [AWS][xen-aws])
- VirtIO ([Community][virtio-virtio], [Alibaba Cloud][virtio-aliyun], [Tencent Cloud][virtio-qcloud], [GCP][virtio-gcp])
- XEN ([~~Community~~][xen-xen] (unsigned), [Citrix][xen-citrix], [AWS][xen-aws])
- AWS ([ENA Network Adapter][aws-ena], [NVME Storage Controller][aws-nvme])
- GCP ([gVNIC Network Adapter][gcp-gvnic], [GGA Display Adapter][gcp-gga])
- Azure ([MANA Network Adapter][azure-mana])
@@ -421,7 +455,7 @@ bash reinstall.sh windows \
[intel-nic-8.1]: https://www.intel.com/content/www/us/en/download/17479/intel-network-adapter-driver-for-windows-8-1.html
[intel-nic-10]: https://www.intel.com/content/www/us/en/download/18293/intel-network-adapter-driver-for-windows-10.html
[intel-nic-11]: https://www.intel.com/content/www/us/en/download/727998/intel-network-adapter-driver-for-microsoft-windows-11.html
[intel-nic-2008-r2]: https://www.intel.com/content/www/us/en/download/15591/intel-network-adapter-driver-for-windows-server-2008-r2-final-release.html
[intel-nic-2008-r2]: https://web.archive.org/web/20250501002542/https://www.intel.com/content/www/us/en/download/15591/intel-network-adapter-driver-for-windows-server-2008-r2-final-release.html
[intel-nic-2012]: https://www.intel.com/content/www/us/en/download/16789/intel-network-adapter-driver-for-windows-server-2012.html
[intel-nic-2012-r2]: https://www.intel.com/content/www/us/en/download/17480/intel-network-adapter-driver-for-windows-server-2012-r2.html
[intel-nic-2016]: https://www.intel.com/content/www/us/en/download/18737/intel-network-adapter-driver-for-windows-server-2016.html
@@ -431,7 +465,7 @@ bash reinstall.sh windows \
#### How to Specify the Image Name `--image-name`
Typically, an ISO will contain multiple system versions, such as Home Edition and Professional Edition. The image name `--image-name` is used to specify the version to be installed, and it is case-insensitive when entered.
An ISO usually contains multiple system editions, such as Home and Pro. Therefore, you need to use `--image-name` to specify the system edition (image name) to install, case-insensitive.
You can use tools like DISM, DISM++, or Wimlib to query the image names included in the ISO.
@@ -492,10 +526,18 @@ Log in to the server using Remote Desktop, open Device Manager, locate the graph
</details>
## Discussion
## Parameter Format
[![GitHub Issues](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bin456789/reinstall/issues)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
### --ssh-key
- `--ssh-key "ssh-rsa ..."`
- `--ssh-key "ssh-ed25519 ..."`
- `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."`
- `--ssh-key http://path/to/public_key`
- `--ssh-key github:your_username`
- `--ssh-key gitlab:your_username`
- `--ssh-key /path/to/public_key`
- `--ssh-key C:\path\to\public_key`
## How to Modify the Script for Your Own
@@ -505,8 +547,6 @@ Log in to the server using Remote Desktop, open Device Manager, locate the graph
## Thanks
[![Github Sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789)
Thanks to the following businesses for providing free servers.
[![Oracle Cloud](https://github.com/bin456789/reinstall/assets/7548515/8b430ed4-8344-4f96-b4da-c2bda031cc90)](https://www.oracle.com/cloud/)

134
README.md
View File

@@ -5,24 +5,39 @@
[![Codacy](https://img.shields.io/codacy/grade/dc679a17751448628fe6d8ac35e26eed?logo=Codacy&label=Codacy&style=flat-square)](https://app.codacy.com/gh/bin456789/reinstall/dashboard)
[![CodeFactor](https://img.shields.io/codefactor/grade/github/bin456789/reinstall?logo=CodeFactor&logoColor=white&label=CodeFactor&style=flat-square)](https://www.codefactor.io/repository/github/bin456789/reinstall)
[![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&label=Lines%20of%20Code&style=flat-square)](https://github.com/XAMPPRocky/tokei_rs)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=flat-square&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
[![Github Sponsors](https://img.shields.io/badge/sponsor-30363D?style=flat-square&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789)
一键重装脚本 [English](README.en.md)
一键 VPS 系统重装脚本 [English](README.en.md)
[![Sponsors](https://raw.githubusercontent.com/bin456789/sponsors/refs/heads/master/sponsors.svg)](https://github.com/sponsors/bin456789)
## 介绍
## 亮点
- 一键安装 Linux支持 19 种常见发行版
- 一键安装 Windows使用官方 ISO 安装而非自制镜像,脚本会自动获取 ISO 链接、自动安装 Virtio 等常见驱动
- 一键重装到 Linux支持 19 种常见发行版
- 一键重装到 Windows使用官方原版 ISO 而非自制镜像,脚本支持自动查找 ISO 链接、自动安装 `VirtIO` 等公有云驱动
- 支持任意方向重装,即 `Linux to Linux``Linux to Windows``Windows to Windows``Windows to Linux`
- 无需填写 IP 参数,自动识别动静态,支持 `/32``/128``网关不在子网范围内``纯 IPv6``网卡`
- 自动设置 IP智能设置动静态,支持 `/32``/128``网关不在子网范围内``纯 IPv6``IPv4/IPv6 在不同的网卡`
- 专门适配低配小鸡,比官方 netboot 需要更少的内存
- 全程用分区表 ID 识别硬盘,确保不会写错硬盘
- 支持 BIOS、EFI 引导,支持 ARM 服务器
- 不含自制包,所有资源均实时从镜像源获得
如果帮到你,可以请我喝奶茶。
[![Donate](https://img.shields.io/badge/Donate-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789)
[![Sponsors](https://raw.githubusercontent.com/bin456789/sponsors/refs/heads/master/sponsors.svg)](https://github.com/sponsors/bin456789)
### 反馈
[![GitHub Issues](https://img.shields.io/badge/GitHub-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bin456789/reinstall/issues)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
## 快速开始
- [下载](#下载当前系统是--linux)
- [功能 1. 一键重装到 Linux](#功能-1-安装--linux)
- [功能 2. 一键 DD Raw 镜像到硬盘](#功能-2-dd-raw-镜像到硬盘)
- [功能 3. 一键引导到 Alpine Live OS 内存系统](#功能-3-重启到--alpine-live-os内存系统)
- [功能 4. 一键引导到 netboot.xyz](#功能-4-重启到--netbootxyz)
- [功能 5. 一键重装到 Windows](#功能-5-安装--windows-iso)
## 系统要求
原系统可以是表格中的任意系统
@@ -56,6 +71,13 @@
^ 表示需要 256 MB 内存 + 1.5 GB 硬盘,或 512 MB 内存 + 1 GB 硬盘
> [!WARNING]
>
> 本脚本理论上支持独服和 PC
>
> 但如果能使用 IPMI 或 U 盘,则不建议使用本脚本
> [!WARNING]
>
> ❌ 本脚本不支持 OpenVZ、LXC 虚拟机
>
> 请改用 <https://github.com/LloydAsp/OsMutation>
@@ -65,13 +87,13 @@
国外服务器:
```bash
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O ${_##*/} $_
```
国内服务器:
```bash
curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O reinstall.sh $_
curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O ${_##*/} $_
```
## 下载(当前系统是 <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows
@@ -113,10 +135,16 @@ certutil -urlcache -f -split https://cnb.cool/bin456789/reinstall/-/git/raw/main
- Linux 下运行 `bash reinstall.sh ...`
- Windows 下先运行 `cmd`,再运行 `reinstall.bat ...`
- 如果参数中的链接包含特殊字符,要用 `""` 将链接包起来,不能用 `''`
- 如果参数中的链接包含特殊字符,要用 `""` 将链接包起来,不能用 `''`
### 功能 1: 安装 <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux
> [!CAUTION]
>
> 此功能会清除当前系统**整个硬盘**的全部数据(包含其它分区)!
>
> 数据无价,请三思而后行!
- 用户名 `root` 默认密码 `123@@@`
- 安装最新版可不输入版本号
- 最大化利用磁盘空间:不含 boot 分区Fedora 例外),不含 swap 分区
@@ -149,15 +177,7 @@ bash reinstall.sh anolis 7|8|23
#### 可选参数
- `--password PASSWORD` 设置密码
- `--ssh-key KEY` 设置 SSH 登录公钥,支持以下格式。当使用公钥时,密码为空
- `--ssh-key "ssh-rsa ..."`
- `--ssh-key "ssh-ed25519 ..."`
- `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."`
- `--ssh-key http://path/to/public_key`
- `--ssh-key github:your_username`
- `--ssh-key gitlab:your_username`
- `--ssh-key /path/to/public_key`
- `--ssh-key C:\path\to\public_key`
- `--ssh-key KEY` 设置 SSH 登录公钥,[格式如下](#--ssh-key)。当使用公钥时,密码为空
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用,也作用于新系统)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透
@@ -201,7 +221,13 @@ bash reinstall.sh ubuntu --installer
</details>
### 功能 2: DD
### 功能 2: DD RAW 镜像到硬盘
> [!CAUTION]
>
> 此功能会清除当前系统**整个硬盘**的全部数据(包含其它分区)!
>
> 数据无价,请三思而后行!
- 支持 `raw` `vhd` 格式的镜像(未压缩,或者压缩成 `.gz` `.xz` `.zst` `.tar` `.tar.gz` `.tar.xz` `.tar.zst`
- DD Windows 镜像时,会自动扩展系统盘,静态 IP 的机器会配置好 IP可能首次开机几分钟后才生效
@@ -226,9 +252,14 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz"
### 功能 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 等操作
- 用户名 `root` 默认密码 `123@@@`
- 如果手动操作没有破坏原系统,再次重启将回到原系统
> [!TIP]
>
> 虽然运行的脚本叫 `reinstall`,但是此功能**不会**删除任何数据和进行自动重装,而是要用户手动操作
>
> 如果用户手动操作没有破坏原系统,再次重启将回到原系统
```bash
bash reinstall.sh alpine --hold=1
@@ -238,21 +269,18 @@ bash reinstall.sh alpine --hold=1
- `--password PASSWORD` 设置密码
- `--ssh-port PORT` 修改 SSH 端口
- `--ssh-key KEY` 设置 SSH 登录公钥,支持以下格式。当使用公钥时,密码为空
- `--ssh-key "ssh-rsa ..."`
- `--ssh-key "ssh-ed25519 ..."`
- `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."`
- `--ssh-key http://path/to/public_key`
- `--ssh-key github:your_username`
- `--ssh-key gitlab:your_username`
- `--ssh-key /path/to/public_key`
- `--ssh-key C:\path\to\public_key`
- `--ssh-key KEY` 设置 SSH 登录公钥,[格式如下](#--ssh-key)。当使用公钥时,密码为空
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透
### 功能 4: 重启到 <img width="16" height="16" src="https://netboot.xyz/img/favicon.ico" /> netboot.xyz
- 可使用商家后台 VNC 手动安装 [更多系统](https://github.com/netbootxyz/netboot.xyz?tab=readme-ov-file#what-operating-systems-are-currently-available-on-netbootxyz)
- 如果手动操作没有破坏原系统,再次重启将回到原系统
> [!TIP]
>
> 虽然运行的脚本叫 `reinstall`,但是此功能**不会**删除任何数据和进行自动重装,而是要用户手动操作
>
> 如果用户手动操作没有破坏原系统,再次重启将回到原系统
```bash
bash reinstall.sh netboot.xyz
@@ -264,6 +292,12 @@ bash reinstall.sh netboot.xyz
![Windows 安装界面](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)
> [!CAUTION]
>
> 此功能会清除当前系统**整个硬盘**的全部数据(包含其它分区)!
>
> 数据无价,请三思而后行!
- 用户名 `administrator` 默认密码 `123@@@`
- 如果远程登录失败,可以尝试使用用户名 `.\administrator`
- 静态机器会自动配置好 IP可能首次开机几分钟后才生效
@@ -276,7 +310,7 @@ bash reinstall.sh netboot.xyz
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
- Azure Local (Azure Stack HCI) \*
#### 方法 1: 让脚本自动查找 ISO
@@ -386,18 +420,18 @@ bash reinstall.sh windows \
- `--password PASSWORD` 设置密码
- `--allow-ping` 设置 Windows 防火墙允许被 Ping
- `--rdp-port PORT` 更改 RDP 端口
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--add-driver INF_OR_DIR` 添加额外驱动,填写 .inf 路径,或者 .inf 所在的文件夹
- 需先下载驱动到本地
- 需先下载驱动到当前系统
- 可多次设置该参数以添加不同的驱动
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透
- `--hold 2` 在进入 Windows 官方安装程序之前,可以 SSH 登录修改硬盘内容,硬盘挂载在 `/os`
#### 以下驱动会自动按需下载安装,无需手动添加
- Virtio ([Virtio][virtio-virtio], [阿里云][virtio-aliyun], [腾讯云][virtio-qcloud], [GCP][virtio-gcp])
- XEN ([~~XEN~~][xen-xen] (未签名), [Citrix][xen-citrix], [AWS][xen-aws])
- VirtIO ([社区版][virtio-virtio], [阿里云][virtio-aliyun], [腾讯云][virtio-qcloud], [GCP][virtio-gcp])
- XEN ([~~社区版~~][xen-xen] (未签名), [Citrix][xen-citrix], [AWS][xen-aws])
- AWS ([ENA 网卡][aws-ena], [NVME 存储控制器][aws-nvme])
- GCP ([gVNIC 网卡][gcp-gvnic], [GGA 显卡][gcp-gga])
- Azure ([MANA 网卡][azure-mana])
@@ -421,7 +455,7 @@ bash reinstall.sh windows \
[intel-nic-8.1]: https://www.intel.com/content/www/us/en/download/17479/intel-network-adapter-driver-for-windows-8-1.html
[intel-nic-10]: https://www.intel.com/content/www/us/en/download/18293/intel-network-adapter-driver-for-windows-10.html
[intel-nic-11]: https://www.intel.com/content/www/us/en/download/727998/intel-network-adapter-driver-for-microsoft-windows-11.html
[intel-nic-2008-r2]: https://www.intel.com/content/www/us/en/download/15591/intel-network-adapter-driver-for-windows-server-2008-r2-final-release.html
[intel-nic-2008-r2]: https://web.archive.org/web/20250501002542/https://www.intel.com/content/www/us/en/download/15591/intel-network-adapter-driver-for-windows-server-2008-r2-final-release.html
[intel-nic-2012]: https://www.intel.com/content/www/us/en/download/16789/intel-network-adapter-driver-for-windows-server-2012.html
[intel-nic-2012-r2]: https://www.intel.com/content/www/us/en/download/17480/intel-network-adapter-driver-for-windows-server-2012-r2.html
[intel-nic-2016]: https://www.intel.com/content/www/us/en/download/18737/intel-network-adapter-driver-for-windows-server-2016.html
@@ -431,7 +465,7 @@ bash reinstall.sh windows \
#### 如何填写映像名称 `--image-name`
通常一个 ISO 包含多个系统版本,例如家庭版、专业版。映像名称 `--image-name` 就是用来指定要安装的版本,填写时不区分大小写
一个 ISO 通常包含多个系统版本,例如家庭版、专业版。因此需要用 `--image-name` 指定要安装的系统版本(映像名称),不区分大小写
可以用 DISM、DISM++、Wimlib 等工具查询 ISO 包含的映像名称
@@ -492,10 +526,18 @@ Windows Server 2025 SERVERDATACENTER
</details>
## 讨论
## 参数格式
[![GitHub Issues](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bin456789/reinstall/issues)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
### --ssh-key
- `--ssh-key "ssh-rsa ..."`
- `--ssh-key "ssh-ed25519 ..."`
- `--ssh-key "ecdsa-sha2-nistp256/384/521 ..."`
- `--ssh-key http://path/to/public_key`
- `--ssh-key github:your_username`
- `--ssh-key gitlab:your_username`
- `--ssh-key /path/to/public_key`
- `--ssh-key C:\path\to\public_key`
## 如何修改脚本自用
@@ -505,8 +547,6 @@ Windows Server 2025 SERVERDATACENTER
## 感谢
[![Github Sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/bin456789)
感谢以下商家提供白嫖机器
[![Oracle Cloud](https://github.com/bin456789/reinstall/assets/7548515/8b430ed4-8344-4f96-b4da-c2bda031cc90)](https://www.oracle.com/cloud/)

View File

@@ -369,6 +369,10 @@ else
sleep $DNS_FILE_TIMEOUT # 需要等待写入 dns
dhcpcd -x "$ethx" # 终止
fi
# autoconf 和 accept_ra 会被 dhcpcd 自动关闭,因此需要重新打开
# 如果没重新打开,重新运行 dhcpcd 命令依然可以正常生成 slaac 地址和路由
sysctl -w "net.ipv6.conf.$ethx.autoconf=1"
sysctl -w "net.ipv6.conf.$ethx.accept_ra=1"
;;
esac
fi

View File

@@ -865,6 +865,7 @@ get_windows_iso_link() {
serverdatacenter | serverdatacentercore) echo _ ;;
esac
;;
# massgrave 不提供 2012 下载
'2012 r2' | \
2016 | 2019 | 2022 | 2025)
case "$edition" in
@@ -889,13 +890,25 @@ get_windows_iso_link() {
case "$edition" in
starter)
case "$arch_win" in
x86) echo ultimate ;;
x86) echo starter ;;
esac
;;
homebasic | homepremium | professional | ultimate) echo ultimate ;;
homebasic)
case "$arch_win" in
x86) echo "home basic" ;;
esac
;;
homepremium) echo "home premium" ;;
professional | enterprise | ultimate) echo "$edition" ;;
esac
;;
# massgrave 不提供 windows 8 下载
8.1)
case "$edition" in
'') echo _ ;; # windows 8.1 core
pro | enterprise) echo "$edition" ;;
esac
;;
# 8.1 需到 msdl.gravesoft.dev 下载
10)
case "$edition" in
home | 'home single language') echo consumer ;;
@@ -947,6 +960,8 @@ get_windows_iso_link() {
esac
}
# 8.1 和 11 arm 没有每月发布 iso
# 因此优先从 msdl 下载
get_label_msdl() {
case "$version" in
8.1)
@@ -992,7 +1007,13 @@ get_windows_iso_link() {
label_vlsc=$(get_label_vlsc)
page=$(get_page)
page_url=https://massgrave.dev/windows_${page}_links
if [ "$page" = vista ]; then
page_url=https://massgrave.dev/windows_vista__links
elif [ "$page" = server ]; then
page_url=https://massgrave.dev/windows-server-links
else
page_url=https://massgrave.dev/windows_${page}_links
fi
info "Find windows iso"
echo "Version: $version"
@@ -1608,7 +1629,9 @@ Continue with DD?
fi
elarch=$basearch
if [ "$distro" = almalinux ] && [ "$basearch" = x86_64 ] && ! is_cpu_supports_x86_64_v3; then
if [ "$basearch" = x86_64 ] &&
[ "$distro" = almalinux ] && [ "$releasever" -ge 10 ] &&
! is_cpu_supports_x86_64_v3; then
elarch=x86_64_v2
fi
@@ -1741,7 +1764,12 @@ Continue with DD?
if is_use_cloud_image; then
# ci
dir=$releasever/images/$basearch
if [ "$releasever" -eq 9 ]; then
dir=$releasever/images/qcow2/$basearch
else
dir=$releasever/images/$basearch
fi
file=$(curl -L $mirror/$dir/ | grep -oP 'OpenCloudOS.*?\.qcow2' |
sort -uV | tail -1 | grep .)
eval ${step}_img=$mirror/$dir/$file

View File

@@ -5858,33 +5858,60 @@ install_windows() {
# 25.0 比 24.5 只更新了 ProSet 软件,驱动相同
echo 18713/eng/prowin${arch_intel}legacy.exe || # 25.0 有部分文件是 sha256 签名
echo 29323/eng/prowin${arch_intel}legacy.exe ;; # 24.3 sha1 签名
'8') echo 21642/eng/prowin${arch_intel}.exe ;;
'8.1') echo 764813/Wired_driver_27.8_${arch_intel}.zip ;;
'2012' | '2012 r2') echo 785805/Wired_driver_28.2_${arch_intel}.zip ;;
# 之前有 Intel® Network Adapter Driver for Windows 8* - Final Release ,版本 22.7.1
# 但已被删除,原因不明
# https://web.archive.org/web/20250501043104/https://www.intel.com/content/www/us/en/download/16765/intel-network-adapter-driver-for-windows-8-final-release.html
# 27.8 有 NDIS63 文件夹,意味着支持 Windows 8
# 27.8 相比 22.7.1,可能有些老设备不支持了,但我们不管了
'8' | '8.1') echo 764813/Wired_driver_27.8_${arch_intel}.zip ;;
'2012' | '2012 r2') echo 772074/Wired_driver_28.0_${arch_intel}.zip ;;
*) case "${arch_intel}" in
32) echo 849483/Wired_driver_30.0.1_${arch_intel}.zip ;;
x64) echo 861427/Wired_driver_30.3_${arch_intel}.zip ;;
x64) echo 864508/Wired_driver_30.4_${arch_intel}.zip ;;
esac ;;
esac
)
web_archive=$(
case "$product_ver" in
'8') echo https://web.archive.org/web/20250501043104/ ;;
esac
)
# 注意 intel 禁止了 aria2 下载
download ${web_archive}https://downloadmirror.intel.com/$file $drv/intel.zip
download https://downloadmirror.intel.com/$file $drv/intel.zip
# inf 可能是 UTF-16 LE因此用 rg 搜索
# 用 busybox unzip 解压 win10 驱动时,路径和文件名会粘在一起
# 但解压 28.0 驱动时,依然会出现这个问题
# 因此需要 convert_backslashes
apk add unzip ripgrep
# https://superuser.com/questions/1382839/zip-files-expand-with-backslashes-on-linux-no-subdirectories
convert_backslashes() {
for file in "$1"/*\\*; do
if [ -f "$file" ]; then
target="${file//\\//}"
mkdir -p "${target%/*}"
mv -v "$file" "$target"
fi
done
}
# win7 驱动是 .exe 解压不会报错
# win10 驱动是 .zip 解压反而会报错,目测 zip 文件有问题
# 在 windows 下解压 win8 的驱动会提示 checksum 错误
unzip -o -d $drv/intel/ $drv/intel.zip || true
convert_backslashes $drv/intel
is_have_inf_in_intel_dir() {
find $drv/intel -ipath "*/*.inf" | grep . >/dev/null
}
# Wired_driver_28.0_x64.zip 需要二次解压
if ! is_have_inf_in_intel_dir; then
unzip -o -d $drv/intel/ $drv/intel/Wired_driver_*.exe || true
convert_backslashes $drv/intel
fi
# 由于上面使用了 || true因此确认下解压后是否有 inf 文件
if ! is_have_inf_in_intel_dir; then
error_and_exit "No .inf file found in intel driver package"
fi
# Vista RTM 版本号是 6000 NDIS 6.0
# 2008 RTM 版本号是 6001 NDIS 6.1