core: 支持原系统为 arm windows

This commit is contained in:
bin456789
2024-01-27 23:08:34 +08:00
parent d90fd569af
commit abda204a50
4 changed files with 297 additions and 215 deletions

View File

@@ -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)
[![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
- 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.
- Excludes third-party links and self-made packages; all resources are fetched in real-time from the source site.
- Adapted for 512M + 5G small VPS, and supports installing Alpine on 256M VPS.
- Supports installing Windows using the official ISO (does not support ARM).
- Supports reinstalling Windows as Linux and vice versa.
- Supports BIOS, EFI, ARM (Windows installation not supported on ARM).
- Supports original system partition with LVM, Btrfs.
- Supports installing Alpine, Arch, openSUSE, Gentoo, and installing from these systems.
- Progress of DD and cloud image installation can be viewed through SSH, a browser, serial console, or background VNC.
- Contains extensive comments.
- 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.
- The script does not include third-party links or homemade packages; all resources are obtained in real-time from the source site.
- Compatible with 512M + 5G small servers and supports installing Alpine on 256M small servers.
- Supports installing Windows using the official ISO.
- Supports reinstalling Windows as Linux or Windows itself.
- Supports BIOS, EFI, ARM.
- The original system partition supports LVM, Btrfs.
- 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, browser, serial console, and background VNC.
- Includes many comments.
## Usage on Linux
## Download (Current system is Linux)
### Download
For users outside China:
```bash
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
```
### Download (from within China)
For users in China:
```bash
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
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 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
rocky 8|9
fedora 38|39
debian 10|11|12
ubuntu 20.04|22.04
alpine 3.16|3.17|3.18|3.19
opensuse 15.5|tumbleweed (supports cloud mirror only)
arch (supports only amd64 cloud mirror)
gentoo (supports only amd64 cloud mirror)
opensuse 15.5|tumbleweed (only supports cloud image)
arch (only supports amd64 cloud image)
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
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 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 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 reinstall.sh netboot.xyz
```
![netboot.xyz](https://netboot.xyz/images/netboot.xyz.gif)
### Usage 5: Install Windows ISO
```bash
bash reinstall.sh windows \
--iso='https://example.com/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
--image-name='Windows 10 Enterprise LTSC 2021'
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
--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
'Windows 7 Ultimate'
@@ -101,111 +135,95 @@ bash reinstall.sh windows \
'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)
#### Other Notes
1. Successfully tested systems: 7, 10, 11, 2022. Tested platforms: vultr (bios), oracle (efi), aws t2 (xen), aws t3 (nitro).
2. Supports 32/64-bit systems; UEFI machines only support 64-bit.
3. Can bypass Windows 11 hardware restrictions.
4. Tested not to support ARM.
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.
1. Supported systems:
- Windows Vista to Windows 11
- Windows Server 2008 to Windows Server 2022
- Windows Server variants, such as
- Windows Server Essentials
- Windows Server Annual Channel
- 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.
<https://www.google.com/search?q=ltsc+wsappx>
6. The following websites contain iso links:
<https://archive.org>
7. The following website provides iso links.
<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
| System | Traditional Install | Cloud Image |
| -------------------------------- | ------------------- | ------------|
| Debian | 384M | 512M |
| Ubuntu | 1G | 512M |
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
| Alpine | 256M | - |
| openSUSE | - | 512M |
| Arch | - | 512M |
| Gentoo | - | 512M |
| Windows | 1G | - |
| System | Traditional Installation | Cloud Image |
| ------------------------------------- | ------------------------ | ----------- |
| Debian | 384M | 512M |
| Ubuntu | 1G | 512M |
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
| Alpine | 256M | - |
| openSUSE | - | 512M |
| Arch | - | 512M |
| Gentoo | - | 512M |
| Windows 8.1 (Server 2012 R2) or below | 512M | - |
| Windows 10 (Server 2016) or above | 1G | - |
## 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.
## Virtualization Requirements
Does not support OpenVZ, LXC virtual machines.
Not supported on OpenVZ, LXC virtual machines.
Please use <https://github.com/LloydAsp/OsMutation>.
## Default Passwords
| System | Username | Password |
| -------------------- | -------------- | -------- |
| Linux | root | 123@@@ |
| Windows (ISO install) | administrator | 123@@@ |
| System | Username | Password |
| ------------- | -------------- | -------------- |
| Linux | root | 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
- 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/)