core: 支持原系统为 arm windows
This commit is contained in:
parent
d90fd569af
commit
abda204a50
218
README.en.md
218
README.en.md
@ -2,97 +2,131 @@
|
|||||||
|
|
||||||
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/dc679a17751448628fe6d8ac35e26eed)](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/dc679a17751448628fe6d8ac35e26eed)](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
||||||
[![CodeFactor](https://www.codefactor.io/repository/github/bin456789/reinstall/badge)](https://www.codefactor.io/repository/github/bin456789/reinstall)
|
[![CodeFactor](https://www.codefactor.io/repository/github/bin456789/reinstall/badge)](https://www.codefactor.io/repository/github/bin456789/reinstall)
|
||||||
[![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code)](#reinstall)
|
[![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&style=flat)](https://github.com/XAMPPRocky/tokei_rs)
|
||||||
|
|
||||||
One-click Reinstallation Script
|
One-click reinstallation script
|
||||||
|
|
||||||
[中文](README.md) | [English](README.en.md)
|
[中文](README.md) | English
|
||||||
|
|
||||||
## Highlights
|
## Highlights
|
||||||
|
|
||||||
- Default usage of official installation programs. In cases where the memory requirements of the installation program are not met, the official cloud image will be used.
|
- By default, the official installation program is used. When the memory requirements of the installation program are not met, the official cloud image (Cloud Image) will be used.
|
||||||
- Excludes third-party links and self-made packages; all resources are fetched in real-time from the source site.
|
- The script does not include third-party links or homemade packages; all resources are obtained in real-time from the source site.
|
||||||
- Adapted for 512M + 5G small VPS, and supports installing Alpine on 256M VPS.
|
- Compatible with 512M + 5G small servers and supports installing Alpine on 256M small servers.
|
||||||
- Supports installing Windows using the official ISO (does not support ARM).
|
- Supports installing Windows using the official ISO.
|
||||||
- Supports reinstalling Windows as Linux and vice versa.
|
- Supports reinstalling Windows as Linux or Windows itself.
|
||||||
- Supports BIOS, EFI, ARM (Windows installation not supported on ARM).
|
- Supports BIOS, EFI, ARM.
|
||||||
- Supports original system partition with LVM, Btrfs.
|
- The original system partition supports LVM, Btrfs.
|
||||||
- Supports installing Alpine, Arch, openSUSE, Gentoo, and installing from these systems.
|
- Supports installing Alpine, Arch, openSUSE, Gentoo, and can also install these systems from them.
|
||||||
- Progress of DD and cloud image installation can be viewed through SSH, a browser, serial console, or background VNC.
|
- Progress of DD and cloud image installation can be viewed through SSH, browser, serial console, and background VNC.
|
||||||
- Contains extensive comments.
|
- Includes many comments.
|
||||||
|
|
||||||
## Usage on Linux
|
## Download (Current system is Linux)
|
||||||
|
|
||||||
### Download
|
For users outside China:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Download (from within China)
|
For users in China:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -O https://raw.fgit.cf/bin456789/reinstall/main/reinstall.sh
|
curl -O https://raw.fgit.cf/bin456789/reinstall/main/reinstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Download (Current system is Windows)
|
||||||
|
|
||||||
|
First, disable the `Real-time Protection` feature of `Windows Defender`.
|
||||||
|
|
||||||
|
For users outside China:
|
||||||
|
|
||||||
|
```batch
|
||||||
|
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
For users in China:
|
||||||
|
|
||||||
|
```batch
|
||||||
|
certutil -urlcache -f -split https://raw.fgit.cf/bin456789/reinstall/main/reinstall.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
[Unable to download?](#if-the-script-cannot-be-downloaded-under-windows)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- The following examples are for running on Linux; for Windows, run `reinstall.bat` with the same parameters.
|
||||||
|
|
||||||
### Usage 1: Install Linux
|
### Usage 1: Install Linux
|
||||||
|
|
||||||
Note: For machines with static IP, installing centos, alma, rocky, fedora, debian, ubuntu, requires adding the --ci parameter to force the use of the cloud mirror.
|
- For machines with static IP, install CentOS, Alma, Rocky, Fedora, Debian, Ubuntu, and add the --ci parameter to force the use of the cloud image.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh centos 7|8|9 (8|9 for stream versions)
|
bash reinstall.sh centos 7|8|9 (8|9 for the stream version)
|
||||||
alma 8|9
|
alma 8|9
|
||||||
rocky 8|9
|
rocky 8|9
|
||||||
fedora 38|39
|
fedora 38|39
|
||||||
debian 10|11|12
|
debian 10|11|12
|
||||||
ubuntu 20.04|22.04
|
ubuntu 20.04|22.04
|
||||||
alpine 3.16|3.17|3.18|3.19
|
alpine 3.16|3.17|3.18|3.19
|
||||||
opensuse 15.5|tumbleweed (supports cloud mirror only)
|
opensuse 15.5|tumbleweed (only supports cloud image)
|
||||||
arch (supports only amd64 cloud mirror)
|
arch (only supports amd64 cloud image)
|
||||||
gentoo (supports only amd64 cloud mirror)
|
gentoo (only supports amd64 cloud image)
|
||||||
|
|
||||||
If no version number is entered, it installs the latest version.
|
If no version number is entered, the latest version will be installed.
|
||||||
|
```
|
||||||
|
|
||||||
Optional parameters: --ci Force the use of the cloud mirror.
|
Parameters:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--ci Force the use of the cloud image
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage 2: DD
|
### Usage 2: DD
|
||||||
|
|
||||||
Supports gzip, xz formats.
|
- Supports gzip, xz formats.
|
||||||
|
|
||||||
Supports automatic configuration of static IP, system disk expansion.
|
- For machines with static IP, DD Windows, and the script will automatically configure the IP.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh dd --img=https://example.com/xxx.xz
|
bash reinstall.sh dd --img https://example.com/xxx.xz
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage 3: Restart to Alpine Rescue System (Live OS)
|
### Usage 3: Reboot to Alpine Rescue System (Live OS)
|
||||||
|
|
||||||
Can be connected via SSH to perform manual DD, modify partitions, manually install Arch Linux, and other operations.
|
- Can be connected via SSH to perform manual DD, modify partitions, manually install Arch / Gentoo, etc.
|
||||||
|
|
||||||
|
- If the disk content is not modified, rebooting again will return to the original system.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh alpine --hold=1
|
bash reinstall.sh alpine --hold=1
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage 4: Restart to netboot.xyz
|
### Usage 4: Reboot to [netboot.xyz](https://netboot.xyz/)
|
||||||
|
|
||||||
|
- Can install more systems using background VNC.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh netboot.xyz
|
bash reinstall.sh netboot.xyz
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![netboot.xyz](https://netboot.xyz/images/netboot.xyz.gif)
|
||||||
|
|
||||||
### Usage 5: Install Windows ISO
|
### Usage 5: Install Windows ISO
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh windows \
|
bash reinstall.sh windows \
|
||||||
--iso='https://example.com/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
|
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
|
||||||
--image-name='Windows 10 Enterprise LTSC 2021'
|
--image-name 'Windows 10 Enterprise LTSC 2021'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Parameter Description
|
![windows installer](https://filestore.community.support.microsoft.com/api/images/67c13a8c-cee6-47cd-ae80-a55923875c83)
|
||||||
|
|
||||||
`--iso` Original image link without integrating VirtIO, Xen, AWS, GCP drivers.
|
Parameters:
|
||||||
|
|
||||||
`--image-name` Specifies the image to install, case insensitive, enclosed in quotes, for example:
|
`--iso` Original image link, no need to integrate VirtIO, Xen, AWS, GCP drivers.
|
||||||
|
|
||||||
|
`--image-name` Specify the image to install, case-insensitive, should be enclosed in quotes on both sides, for example:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
'Windows 7 Ultimate'
|
'Windows 7 Ultimate'
|
||||||
@ -101,77 +135,36 @@ bash reinstall.sh windows \
|
|||||||
'Windows Server 2022 SERVERDATACENTER'
|
'Windows Server 2022 SERVERDATACENTER'
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `Dism++` File menu > Open image file, select the iso to get the image name.
|
Use `Dism++` File menu > Open Image File, select the iso to be installed to get the image name.
|
||||||
|
|
||||||
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
|
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
|
||||||
|
|
||||||
#### Other Notes
|
1. Supported systems:
|
||||||
|
- Windows Vista to Windows 11
|
||||||
1. Successfully tested systems: 7, 10, 11, 2022. Tested platforms: vultr (bios), oracle (efi), aws t2 (xen), aws t3 (nitro).
|
- Windows Server 2008 to Windows Server 2022
|
||||||
2. Supports 32/64-bit systems; UEFI machines only support 64-bit.
|
- Windows Server variants, such as
|
||||||
3. Can bypass Windows 11 hardware restrictions.
|
- Windows Server Essentials
|
||||||
4. Tested not to support ARM.
|
- Windows Server Annual Channel
|
||||||
5. `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso`: After installing this image, the `wsappx` process may occupy CPU for an extended period.
|
- Hyper-V Server
|
||||||
|
- Azure Stack HCI
|
||||||
|
2. BIOS can be used for 32/64 bit, UEFI machines can only use 64-bit.
|
||||||
|
3. If the machine has a static IP, the IP will be automatically set after installation.
|
||||||
|
4. Can bypass Windows 11 hardware restrictions.
|
||||||
|
5. Supports Azure ARM (Hyper-V), does not support Oracle ARM (KVM).
|
||||||
|
6. The process `wsappx` will occupy CPU for a long time after installing the image `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso`.
|
||||||
|
|
||||||
This is an issue with the image, and the solution is to install the `VCLibs` library.
|
This is an issue with the image, and the solution is to install the `VCLibs` library.
|
||||||
|
|
||||||
<https://www.google.com/search?q=ltsc+wsappx>
|
<https://www.google.com/search?q=ltsc+wsappx>
|
||||||
|
|
||||||
6. The following websites contain iso links:
|
7. The following website provides iso links.
|
||||||
|
|
||||||
<https://archive.org>
|
|
||||||
|
|
||||||
<https://massgrave.dev/genuine-installation-media.html>
|
<https://massgrave.dev/genuine-installation-media.html>
|
||||||
|
|
||||||
## Usage on Windows
|
|
||||||
|
|
||||||
Run `cmd` with administrator privileges.
|
|
||||||
|
|
||||||
If running `powershell`, switch to `cmd` first.
|
|
||||||
|
|
||||||
### Download
|
|
||||||
|
|
||||||
```batch
|
|
||||||
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### Download (from within China)
|
|
||||||
|
|
||||||
```batch
|
|
||||||
certutil -urlcache -f -split https://raw.fgit.cf/bin456789/reinstall/main/reinstall.bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### If unable to download
|
|
||||||
|
|
||||||
- Disable Windows Defender real-time protection.
|
|
||||||
|
|
||||||
- Update SSL root certificate.
|
|
||||||
|
|
||||||
```batch
|
|
||||||
certutil -generateSSTFromWU root.sst
|
|
||||||
certutil -addstore Root root.sst
|
|
||||||
```
|
|
||||||
|
|
||||||
- Save the following two files via 'Save link as' or use 'Remote Desktop' to copy:
|
|
||||||
|
|
||||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
|
||||||
|
|
||||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
All functionalities available in Linux can be used on Windows, using parameters similar to those in Linux.
|
|
||||||
|
|
||||||
For example, to install centos 7:
|
|
||||||
|
|
||||||
```batch
|
|
||||||
reinstall.bat centos-7
|
|
||||||
```
|
|
||||||
|
|
||||||
## Memory Requirements
|
## Memory Requirements
|
||||||
|
|
||||||
| System | Traditional Install | Cloud Image |
|
| System | Traditional Installation | Cloud Image |
|
||||||
| -------------------------------- | ------------------- | ------------|
|
| ------------------------------------- | ------------------------ | ----------- |
|
||||||
| Debian | 384M | 512M |
|
| Debian | 384M | 512M |
|
||||||
| Ubuntu | 1G | 512M |
|
| Ubuntu | 1G | 512M |
|
||||||
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
|
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
|
||||||
@ -179,33 +172,58 @@ reinstall.bat centos-7
|
|||||||
| openSUSE | - | 512M |
|
| openSUSE | - | 512M |
|
||||||
| Arch | - | 512M |
|
| Arch | - | 512M |
|
||||||
| Gentoo | - | 512M |
|
| Gentoo | - | 512M |
|
||||||
| Windows | 1G | - |
|
| Windows 8.1 (Server 2012 R2) or below | 512M | - |
|
||||||
|
| Windows 10 (Server 2016) or above | 1G | - |
|
||||||
|
|
||||||
## Network Requirements
|
## Network Requirements
|
||||||
|
|
||||||
For 'Installation Mode' installing Linux, DHCPv4 is required.
|
Install Linux using the `Install Mode` must have DHCPv4.
|
||||||
|
|
||||||
Other cases support static IP, IPv6 (including installing Alpine, cloud mirror, Windows iso, dd).
|
Other cases support static IP, IPv6 (including installing Alpine, Linux cloud image, Windows iso, dd).
|
||||||
|
|
||||||
No need to fill in the static IP address when running the script.
|
No need to fill in the static IP address when running the script.
|
||||||
|
|
||||||
## Virtualization Requirements
|
## Virtualization Requirements
|
||||||
|
|
||||||
Does not support OpenVZ, LXC virtual machines.
|
Not supported on OpenVZ, LXC virtual machines.
|
||||||
|
|
||||||
Please use <https://github.com/LloydAsp/OsMutation>.
|
Please use <https://github.com/LloydAsp/OsMutation>.
|
||||||
|
|
||||||
## Default Passwords
|
## Default Passwords
|
||||||
|
|
||||||
| System | Username | Password |
|
| System | Username | Password |
|
||||||
| -------------------- | -------------- | -------- |
|
| ------------- | -------------- | -------------- |
|
||||||
| Linux | root | 123@@@ |
|
| Linux | root | 123@@@ |
|
||||||
| Windows (ISO install) | administrator | 123@@@ |
|
| Windows (iso) | administrator | 123@@@ |
|
||||||
|
| Windows (dd) | Image username | Image password |
|
||||||
|
|
||||||
|
## If the script cannot be downloaded under Windows
|
||||||
|
|
||||||
|
You can try the following methods:
|
||||||
|
|
||||||
|
1. Disable Windows Defender Real-time Protection.
|
||||||
|
|
||||||
|
2. For Windows 7, install this patch to enable TLS 1.2.
|
||||||
|
|
||||||
|
<https://aka.ms/easyfix51044>
|
||||||
|
|
||||||
|
3. Update SSL root certificates.
|
||||||
|
|
||||||
|
```batch
|
||||||
|
certutil -generateSSTFromWU root.sst
|
||||||
|
certutil -addstore Root root.sst
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Download manually by copying these two files through `Remote Desktop Connection`.
|
||||||
|
|
||||||
|
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
||||||
|
|
||||||
|
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Installation modes: Static IP, IPv6, multiple NICs.
|
- Install mode: Static IP, IPv6, multiple NICs
|
||||||
|
|
||||||
## Sponsor
|
## Promotion
|
||||||
|
|
||||||
[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/7531e443-4069-4bf1-a40e-2e965f311e3f)](https://dartnode.com/)
|
[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/7531e443-4069-4bf1-a40e-2e965f311e3f)](https://dartnode.com/)
|
||||||
|
177
README.md
177
README.md
@ -2,42 +2,65 @@
|
|||||||
|
|
||||||
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/dc679a17751448628fe6d8ac35e26eed)](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/dc679a17751448628fe6d8ac35e26eed)](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
||||||
[![CodeFactor](https://www.codefactor.io/repository/github/bin456789/reinstall/badge)](https://www.codefactor.io/repository/github/bin456789/reinstall)
|
[![CodeFactor](https://www.codefactor.io/repository/github/bin456789/reinstall/badge)](https://www.codefactor.io/repository/github/bin456789/reinstall)
|
||||||
[![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code)](#reinstall)
|
[![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&style=flat)](https://github.com/XAMPPRocky/tokei_rs)
|
||||||
|
|
||||||
一键重装脚本
|
一键重装脚本
|
||||||
|
|
||||||
[中文](README.md) | [English](README.en.md)
|
中文 | [English](README.en.md)
|
||||||
|
|
||||||
## 亮点
|
## 亮点
|
||||||
|
|
||||||
- 默认使用官方安装程序,不满足安装程序内存要求时,将使用官方云镜像 (Cloud Image)
|
- 默认使用官方安装程序,不满足安装程序内存要求时,将使用官方云镜像 (Cloud Image)
|
||||||
- 不含第三方链接和自制包,所有资源均实时从源站点获得
|
- 不含第三方链接和自制包,所有资源均实时从源站点获得
|
||||||
- 适配 512M + 5G 小鸡,并支持 256M 小鸡安装 Alpine
|
- 适配 512M + 5G 小鸡,并支持 256M 小鸡安装 Alpine
|
||||||
- 支持用官方 iso 安装 Windows (不支持 ARM)
|
- 支持用官方 iso 安装 Windows
|
||||||
- 支持 Windows 重装成 Linux,也可重装 Windows
|
- 支持 Windows 重装成 Linux,也可重装 Windows
|
||||||
- 支持 BIOS、EFI、ARM (ARM 不支持安装 Windows)
|
- 支持 BIOS、EFI、ARM
|
||||||
- 原系统分区支持 LVM、Btrfs
|
- 原系统分区支持 LVM、Btrfs
|
||||||
- 支持安装 Alpine、Arch、openSUSE、Gentoo,也可从这些系统安装
|
- 支持安装 Alpine、Arch、openSUSE、Gentoo,也可从这些系统安装
|
||||||
- 可通过 SSH、浏览器、串行控制台、后台 VNC 查看 DD、云镜像安装进度
|
- 可通过 SSH、浏览器、串行控制台、后台 VNC 查看 DD、云镜像安装进度
|
||||||
- 有很多注释
|
- 有很多注释
|
||||||
|
|
||||||
## Linux 下使用
|
## 下载(当前系统是 Linux)
|
||||||
|
|
||||||
### 下载
|
国外:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 下载 (国内)
|
国内:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -O https://raw.fgit.cf/bin456789/reinstall/main/reinstall.sh
|
curl -O https://raw.fgit.cf/bin456789/reinstall/main/reinstall.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 下载(当前系统是 Windows)
|
||||||
|
|
||||||
|
先关闭 `Windows Defender` 的 `实时保护` 功能
|
||||||
|
|
||||||
|
国外:
|
||||||
|
|
||||||
|
```batch
|
||||||
|
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
国内:
|
||||||
|
|
||||||
|
```batch
|
||||||
|
certutil -urlcache -f -split https://raw.fgit.cf/bin456789/reinstall/main/reinstall.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
[无法下载?](#如果-windows-下无法下载脚本)
|
||||||
|
|
||||||
|
## 使用
|
||||||
|
|
||||||
|
- 以下用法以 Linux 下运行为例
|
||||||
|
- Windows 下运行 `reinstall.bat`,参数相同
|
||||||
|
|
||||||
### 用法 1: 安装 Linux
|
### 用法 1: 安装 Linux
|
||||||
|
|
||||||
注意:静态 IP 的机器安装 centos、alma、rocky、fedora、debian、ubuntu,需添加参数 --ci 强制使用云镜像
|
- 静态 IP 的机器安装 centos、alma、rocky、fedora、debian、ubuntu,需添加参数 --ci 强制使用云镜像
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本)
|
bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本)
|
||||||
@ -52,43 +75,55 @@ bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本)
|
|||||||
gentoo (只支持 amd64 云镜像)
|
gentoo (只支持 amd64 云镜像)
|
||||||
|
|
||||||
不输入版本号,则安装最新版
|
不输入版本号,则安装最新版
|
||||||
|
```
|
||||||
|
|
||||||
可选参数: --ci 强制使用云镜像
|
参数:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
--ci 强制使用云镜像
|
||||||
```
|
```
|
||||||
|
|
||||||
### 用法 2: DD
|
### 用法 2: DD
|
||||||
|
|
||||||
支持 gzip、xz 格式
|
- 支持 gzip、xz 格式
|
||||||
|
|
||||||
支持自动配置静态 IP、扩展系统盘
|
- 静态 IP 的机器 DD Windows,会自动配置好 IP
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh dd --img=https://example.com/xxx.xz
|
bash reinstall.sh dd --img https://example.com/xxx.xz
|
||||||
```
|
```
|
||||||
|
|
||||||
### 用法 3:重启到 Alpine 救援系统 (Live OS)
|
### 用法 3: 重启到 Alpine 救援系统 (Live OS)
|
||||||
|
|
||||||
可用 ssh 连接,进行手动 DD、修改分区、手动安装 Arch Linux 等操作
|
- 可用 ssh 连接,进行手动 DD、修改分区、手动安装 Arch / Gentoo 等操作
|
||||||
|
|
||||||
|
- 如果没有修改硬盘内容,再次重启将回到原系统
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh alpine --hold=1
|
bash reinstall.sh alpine --hold=1
|
||||||
```
|
```
|
||||||
|
|
||||||
### 用法 4:重启到 netboot.xyz
|
### 用法 4: 重启到 [netboot.xyz](https://netboot.xyz/)
|
||||||
|
|
||||||
|
- 可使用后台 VNC 安装更多系统
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh netboot.xyz
|
bash reinstall.sh netboot.xyz
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![netboot.xyz](https://netboot.xyz/images/netboot.xyz.gif)
|
||||||
|
|
||||||
### 用法 5: 安装 Windows ISO
|
### 用法 5: 安装 Windows ISO
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash reinstall.sh windows \
|
bash reinstall.sh windows \
|
||||||
--iso='https://example.com/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
|
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
|
||||||
--image-name='Windows 10 Enterprise LTSC 2021'
|
--image-name 'Windows 10 Enterprise LTSC 2021'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 参数说明
|
![windows installer](https://filestore.community.support.microsoft.com/api/images/67c13a8c-cee6-47cd-ae80-a55923875c83)
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
`--iso` 原版镜像链接,无需集成 VirtIO、Xen、AWS、GCP 驱动
|
`--iso` 原版镜像链接,无需集成 VirtIO、Xen、AWS、GCP 驱动
|
||||||
|
|
||||||
@ -105,73 +140,32 @@ bash reinstall.sh windows \
|
|||||||
|
|
||||||
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
|
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
|
||||||
|
|
||||||
#### 其它说明
|
1. 支持的系统:
|
||||||
|
- Windows Vista 到 Windows 11
|
||||||
1. 测试成功的系统有 7 10 11 2022,测试平台为 vultr (bios)、甲骨文 (efi)、aws t2 (xen)、aws t3 (nitro)
|
- Windows Server 2008 到 Windows Server 2022
|
||||||
2. 支持 32/64 位系统,UEFI 机器只支持 64 位
|
- Windows Server 变体,例如
|
||||||
3. 可绕过 Windows 11 硬件限制
|
- Windows Server Essentials
|
||||||
4. 实测不支持 ARM
|
- Windows Server Annual Channel
|
||||||
5. `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso` 此镜像安装后 `wsappx` 进程会长期占用 CPU
|
- Hyper-V Server
|
||||||
|
- Azure Stack HCI
|
||||||
|
2. BIOS 可使用 32/64 位,UEFI 机器只可使用 64 位
|
||||||
|
3. 如果机器是静态 IP,安装后会自动设置 IP
|
||||||
|
4. 可绕过 Windows 11 硬件限制
|
||||||
|
5. 支持 Azure ARM (Hyper-V),不支持甲骨文 ARM (KVM)
|
||||||
|
6. `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso` 此镜像安装后 `wsappx` 进程会长期占用 CPU
|
||||||
|
|
||||||
这是镜像的问题,解决方法是安装 `VCLibs` 库
|
这是镜像的问题,解决方法是安装 `VCLibs` 库
|
||||||
|
|
||||||
<https://www.google.com/search?q=ltsc+wsappx>
|
<https://www.google.com/search?q=ltsc+wsappx>
|
||||||
|
|
||||||
6. 以下网站可找到 iso 链接
|
7. 以下网站可找到 iso 链接
|
||||||
|
|
||||||
<https://archive.org>
|
|
||||||
|
|
||||||
<https://massgrave.dev/genuine-installation-media.html>
|
<https://massgrave.dev/genuine-installation-media.html>
|
||||||
|
|
||||||
## Windows 下使用
|
|
||||||
|
|
||||||
管理员权限运行 `cmd`
|
|
||||||
|
|
||||||
如果运行的是 `powershell`,先进入 `cmd`
|
|
||||||
|
|
||||||
### 下载
|
|
||||||
|
|
||||||
```batch
|
|
||||||
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### 下载(国内)
|
|
||||||
|
|
||||||
```batch
|
|
||||||
certutil -urlcache -f -split https://raw.fgit.cf/bin456789/reinstall/main/reinstall.bat
|
|
||||||
```
|
|
||||||
|
|
||||||
### 如果无法下载
|
|
||||||
|
|
||||||
- 关闭 Windows Defender 实时保护
|
|
||||||
|
|
||||||
- 更新 SSL 根证书
|
|
||||||
|
|
||||||
```batch
|
|
||||||
certutil -generateSSTFromWU root.sst
|
|
||||||
certutil -addstore Root root.sst
|
|
||||||
```
|
|
||||||
|
|
||||||
- `链接另存为`、`远程桌面` 复制以下两个文件
|
|
||||||
|
|
||||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
|
||||||
|
|
||||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
|
||||||
|
|
||||||
### 使用
|
|
||||||
|
|
||||||
所有功能均可在 Windows 下使用,参数和 Linux 下使用一样
|
|
||||||
|
|
||||||
以安装 centos 7 为例
|
|
||||||
|
|
||||||
```batch
|
|
||||||
reinstall.bat centos-7
|
|
||||||
```
|
|
||||||
|
|
||||||
## 内存要求
|
## 内存要求
|
||||||
|
|
||||||
| 系统 | 传统安装 | 云镜像 |
|
| 系统 | 传统安装 | 云镜像 |
|
||||||
| ------------------------------ | -------- | ------ |
|
| ----------------------------------- | -------- | ------ |
|
||||||
| Debian | 384M | 512M |
|
| Debian | 384M | 512M |
|
||||||
| Ubuntu | 1G | 512M |
|
| Ubuntu | 1G | 512M |
|
||||||
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
|
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
|
||||||
@ -179,13 +173,14 @@ reinstall.bat centos-7
|
|||||||
| openSUSE | - | 512M |
|
| openSUSE | - | 512M |
|
||||||
| Arch | - | 512M |
|
| Arch | - | 512M |
|
||||||
| Gentoo | - | 512M |
|
| Gentoo | - | 512M |
|
||||||
| Windows | 1G | - |
|
| Windows 8.1 (Server 2012 R2) 或以下 | 512M | - |
|
||||||
|
| Windows 10 (Server 2016) 或以上 | 1G | - |
|
||||||
|
|
||||||
## 网络要求
|
## 网络要求
|
||||||
|
|
||||||
用`安装模式`安装 Linux 要有 DHCPv4
|
用`安装模式`安装 Linux 要有 DHCPv4
|
||||||
|
|
||||||
其他情况支持静态 IP、IPv6(包括安装 Alpine、云镜像、Windows iso、dd)
|
其他情况支持静态 IP、IPv6(包括安装 Alpine、Linux 云镜像、Windows iso、dd)
|
||||||
|
|
||||||
运行脚本时不需要填写静态 IP 地址
|
运行脚本时不需要填写静态 IP 地址
|
||||||
|
|
||||||
@ -198,14 +193,38 @@ reinstall.bat centos-7
|
|||||||
## 默认密码
|
## 默认密码
|
||||||
|
|
||||||
| 系统 | 用户名 | 密码 |
|
| 系统 | 用户名 | 密码 |
|
||||||
| ------------------ | ------------- | ------ |
|
| ------------- | ------------- | -------- |
|
||||||
| Linux | root | 123@@@ |
|
| Linux | root | 123@@@ |
|
||||||
| Windows (iso 安装) | administrator | 123@@@ |
|
| Windows (iso) | administrator | 123@@@ |
|
||||||
|
| Windows (dd) | 镜像用户名 | 镜像密码 |
|
||||||
|
|
||||||
|
## 如果 Windows 下无法下载脚本
|
||||||
|
|
||||||
|
可尝试以下几种方法
|
||||||
|
|
||||||
|
1. 关闭 Windows Defender 实时保护
|
||||||
|
|
||||||
|
2. Windows 7 安装此补丁启用 TLS 1.2
|
||||||
|
|
||||||
|
<https://aka.ms/easyfix51044>
|
||||||
|
|
||||||
|
3. 更新 SSL 根证书
|
||||||
|
|
||||||
|
```batch
|
||||||
|
certutil -generateSSTFromWU root.sst
|
||||||
|
certutil -addstore Root root.sst
|
||||||
|
```
|
||||||
|
|
||||||
|
4. 手动下载,通过 `远程桌面` 复制这两个文件
|
||||||
|
|
||||||
|
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
||||||
|
|
||||||
|
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- 安装模式:静态 IP、IPv6、多网卡
|
- 安装模式:静态 IP、IPv6、多网卡
|
||||||
|
|
||||||
## 赞助
|
## 推广
|
||||||
|
|
||||||
[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/7531e443-4069-4bf1-a40e-2e965f311e3f)](https://dartnode.com/)
|
[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/7531e443-4069-4bf1-a40e-2e965f311e3f)](https://dartnode.com/)
|
||||||
|
@ -49,17 +49,34 @@ set pkgs="curl,cpio,p7zip,bind-utils,ipcalc"
|
|||||||
set tags=%tmp%\cygwin-installed-!pkgs!
|
set tags=%tmp%\cygwin-installed-!pkgs!
|
||||||
if not exist !tags! (
|
if not exist !tags! (
|
||||||
:: 检查32/64位
|
:: 检查32/64位
|
||||||
wmic os get osarchitecture | findstr /c:"64" >nul
|
:: win10 arm 支持运行 x86 软件
|
||||||
if !errorlevel! == 0 (
|
:: win11 arm 支持运行 x86 和 x86_64 软件
|
||||||
set arch=x86_64
|
:: wmic os get osarchitecture
|
||||||
|
wmic ComputerSystem get SystemType | find "ARM" > nul
|
||||||
|
if not errorlevel 1 (
|
||||||
|
for /f "tokens=2 delims==" %%a in ('wmic os get BuildNumber /format:list ^| find "BuildNumber"') do set BuildNumber=%%a
|
||||||
|
if !BuildNumber! GEQ 22000 (
|
||||||
|
set CygwinArch=x86_64
|
||||||
|
) else (
|
||||||
|
set CygwinArch=x86
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
wmic ComputerSystem get SystemType | find "x64" > nul
|
||||||
|
if not errorlevel 1 (
|
||||||
|
set CygwinArch=x86_64
|
||||||
|
) else (
|
||||||
|
set CygwinArch=x86
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if "!CygwinArch!" == "x86_64" (
|
||||||
set dir=/sourceware/cygwin
|
set dir=/sourceware/cygwin
|
||||||
) else (
|
) else (
|
||||||
set arch=x86
|
|
||||||
set dir=/sourceware/cygwin-archive/20221123
|
set dir=/sourceware/cygwin-archive/20221123
|
||||||
)
|
)
|
||||||
|
|
||||||
:: 下载 Cygwin
|
:: 下载 Cygwin
|
||||||
call :download http://www.cygwin.com/setup-!arch!.exe %tmp%\setup-cygwin.exe
|
call :download http://www.cygwin.com/setup-!CygwinArch!.exe %tmp%\setup-cygwin.exe
|
||||||
|
|
||||||
:: 安装 Cygwin
|
:: 安装 Cygwin
|
||||||
set site=!mirror!!dir!
|
set site=!mirror!!dir!
|
||||||
|
44
reinstall.sh
44
reinstall.sh
@ -1092,12 +1092,12 @@ install_grub_win() {
|
|||||||
grub_dir=/tmp/grub-$grub_ver-for-windows
|
grub_dir=/tmp/grub-$grub_ver-for-windows
|
||||||
grub=$grub_dir/grub
|
grub=$grub_dir/grub
|
||||||
|
|
||||||
# 设置 grub 内嵌的模块
|
# 设置 grub 包含的模块
|
||||||
# 原系统是 windows,因此不需要 ext2 lvm xfs btrfs
|
# 原系统是 windows,因此不需要 ext2 lvm xfs btrfs
|
||||||
grub_modules+=" normal minicmd serial ls echo test cat reboot halt linux linux16 chain search all_video configfile"
|
grub_modules+=" normal minicmd serial ls echo test cat reboot halt linux chain search all_video configfile"
|
||||||
grub_modules+=" scsi part_msdos part_gpt fat ntfs ntfscomp lzopio xzio gzio zstd"
|
grub_modules+=" scsi part_msdos part_gpt fat ntfs ntfscomp lzopio xzio gzio zstd"
|
||||||
if ! is_efi; then
|
if ! is_efi; then
|
||||||
grub_modules+=" biosdisk"
|
grub_modules+=" biosdisk linux16"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 设置 grub prefix 为c盘根目录
|
# 设置 grub prefix 为c盘根目录
|
||||||
@ -1109,8 +1109,19 @@ install_grub_win() {
|
|||||||
if is_efi; then
|
if is_efi; then
|
||||||
# efi
|
# efi
|
||||||
info install grub for efi
|
info install grub for efi
|
||||||
|
if [ "$basearch" = aarch64 ]; then
|
||||||
|
alpine_ver=3.19
|
||||||
|
is_in_china && mirror=http://mirrors.tuna.tsinghua.edu.cn/alpine || mirror=https://dl-cdn.alpinelinux.org/alpine
|
||||||
|
grub_efi_apk=$(curl -L $mirror/v$alpine_ver/main/aarch64/ | grep -oP 'grub-efi-.*?apk' | head -1)
|
||||||
|
mkdir -p /tmp/grub-efi
|
||||||
|
curl -L "$mirror/v$alpine_ver/main/aarch64/$grub_efi_apk" | tar xz --warning=no-unknown-keyword -C /tmp/grub-efi/
|
||||||
|
cp -r /tmp/grub-efi/usr/lib/grub/arm64-efi/ $grub_dir
|
||||||
|
$grub-mkimage -p $prefix -O arm64-efi -o "$(cygpath -w $grub_dir/grubaa64.efi)" $grub_modules
|
||||||
|
add_efi_entry_in_windows $grub_dir/grubaa64.efi
|
||||||
|
else
|
||||||
$grub-mkimage -p $prefix -O x86_64-efi -o "$(cygpath -w $grub_dir/grubx64.efi)" $grub_modules
|
$grub-mkimage -p $prefix -O x86_64-efi -o "$(cygpath -w $grub_dir/grubx64.efi)" $grub_modules
|
||||||
add_efi_entry_in_windows $grub_dir/grubx64.efi
|
add_efi_entry_in_windows $grub_dir/grubx64.efi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# bios
|
# bios
|
||||||
info install grub for bios
|
info install grub for bios
|
||||||
@ -1446,13 +1457,30 @@ if [ "$distro" = alpine ] && is_use_cloud_image; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 检查硬件架构
|
# 检查硬件架构
|
||||||
# x86强制使用x64
|
if is_in_windows; then
|
||||||
|
# x86-based PC
|
||||||
|
# x64-based PC
|
||||||
|
# ARM-based PC
|
||||||
|
# ARM64-based PC
|
||||||
|
basearch=$(wmic ComputerSystem get SystemType /format:list |
|
||||||
|
grep '=' | cut -d= -f2 | cut -d- -f1)
|
||||||
|
else
|
||||||
# archlinux 云镜像没有 arch 命令
|
# archlinux 云镜像没有 arch 命令
|
||||||
|
# https://en.wikipedia.org/wiki/Uname
|
||||||
basearch=$(uname -m)
|
basearch=$(uname -m)
|
||||||
[ $basearch = i686 ] && basearch=x86_64
|
fi
|
||||||
case "$basearch" in
|
|
||||||
"x86_64") basearch_alt=amd64 ;;
|
# 统一架构名称,并强制 64 位
|
||||||
"aarch64") basearch_alt=arm64 ;;
|
case "$(echo $basearch | to_lower)" in
|
||||||
|
i?86 | x64 | x86* | amd64)
|
||||||
|
basearch=x86_64
|
||||||
|
basearch_alt=amd64
|
||||||
|
;;
|
||||||
|
arm* | aarch64)
|
||||||
|
basearch=aarch64
|
||||||
|
basearch_alt=arm64
|
||||||
|
;;
|
||||||
|
*) error_and_exit "Unsupported arch: $basearch" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# 设置国内代理
|
# 设置国内代理
|
||||||
|
Loading…
Reference in New Issue
Block a user