Skip to content

Commit c65ece2

Browse files
committed
core: 不重要的优化
1 parent 3c01f59 commit c65ece2

File tree

8 files changed

+155
-79
lines changed

8 files changed

+155
-79
lines changed

README.en.md

Lines changed: 39 additions & 24 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
| <img width="16" height="16" src="https://www.redhat.com/favicon.ico" /> RHEL &nbsp;<img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> AlmaLinux &nbsp;<img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky &nbsp;<img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 8, 9, 10 | 512 MB \* | 5 GB |
5555
| <img width="16" height="16" src="https://opencloudos.org/qq.ico" /> OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
5656
| <img width="16" height="16" src="https://www.centos.org/assets/icons/favicon.svg" /> CentOS Stream | 9, 10 | 512 MB \* | 5 GB |
57-
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 41, 42 | 512 MB \* | 5 GB |
57+
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 42, 43 | 512 MB \* | 5 GB |
5858
| <img width="16" height="16" src="https://www.openeuler.org/favicon.ico" /> openEuler | 20.03 LTS - 24.03 LTS, 25.09 | 512 MB \* | 5 GB |
5959
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | Leap 15.6, 16.0, Tumbleweed (滚动) | 512 MB \* | 5 GB |
6060
| <img width="16" height="16" src="https://nixos.org/favicon.svg" /> NixOS | 25.05 | 512 MB | 5 GB |
6161
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | 滚动 | 512 MB | 5 GB |
6262
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | 滚动 | 512 MB | 5 GB |
63-
| <img width="16" height="16" src="https://aosc.io/assets/distros/aosc-os.svg" /> 安同 OS | 滚动 | 512 MB | 5 GB |
63+
| <img width="16" height="16" src="https://aosc.io/distros/aosc-os.svg" /> 安同 OS | 滚动 | 512 MB | 5 GB |
6464
| <img width="16" height="16" src="https://www.fnnas.com/favicon.ico" /> 飞牛 fnOS | 公测 | 512 MB | 8 GB |
6565
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | 任何 | 512 MB | 取决于镜像 |
6666
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
@@ -145,7 +145,7 @@ certutil -urlcache -f -split https://cnb.cool/bin456789/reinstall/-/git/raw/main
145145
>
146146
> 数据无价,请三思而后行!
147147
148-
- 用户名 `root` 默认密码 `123@@@`
148+
- 用户名为 `root`,脚本会提示输入密码,不输入则使用随机密码
149149
- 安装最新版可不输入版本号
150150
- 最大化利用磁盘空间:不含 boot 分区(Fedora 例外),不含 swap 分区
151151
- 自动根据机器类型选择不同的优化内核,例如 `Cloud``HWE` 内核
@@ -180,14 +180,17 @@ bash reinstall.sh anolis 7|8|23
180180
- `--ssh-key KEY` 设置 SSH 登录公钥,[格式如下](#--ssh-key)。当使用公钥时,密码为空
181181
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用,也作用于新系统)
182182
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
183-
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透
184-
- `--hold 2` 安装结束后不重启,此时可以 SSH 登录修改系统内容,系统挂载在 `/os` (此功能不支持 Debian/Kali)
183+
- `--frpc-toml PATH` 添加 frpc 内网穿透,参数填本地路径或 HTTP 链接
184+
- `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性
185+
- `--hold 2` 安装结束后不重启,用于 SSH 登录修改系统内容,Debian/Kali 会挂载在 `/target`,其它系统会挂载在 `/os`
185186

186187
> [!TIP]
187-
> 安装 Debian/Kali 时,x86 可通过商家后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。
188188
>
189-
> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、商家后台 VNC、串行控制台)查看安装进度。
190-
> <br />即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
189+
> 可通过多种方式(SSH、HTTP 80 端口、商家后台 VNC、串行控制台)查看安装进度。
190+
>
191+
> 即使安装过程出错,也能连接 SSH 手动救砖。
192+
>
193+
> 目标系统非 Debian/Kali 时,可以运行 `/trans.sh alpine` 自动救砖成 Alpine 系统。
191194
192195
<details>
193196

@@ -229,7 +232,7 @@ bash reinstall.sh ubuntu --installer
229232
>
230233
> 数据无价,请三思而后行!
231234
232-
- 支持 `raw` `vhd` 格式的镜像(未压缩,或者压缩成 `.gz` `.xz` `.zst` `.tar` `.tar.gz` `.tar.xz` `.tar.zst`
235+
- 支持 `raw` 和固定大小的 `vhd` 镜像。未压缩或者压缩成 `.gz` `.xz` `.zst` `.tar` `.tar.gz` `.tar.xz` `.tar.zst`
233236
- DD Windows 镜像时,会自动扩展系统盘,静态 IP 的机器会配置好 IP,可能首次开机几分钟后才生效
234237
- DD Linux 镜像时,**不会**修改镜像的任何内容
235238

@@ -243,17 +246,22 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz"
243246
- `--rdp-port PORT` 修改 RDP 端口 (仅限 DD Windows)
244247
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用)
245248
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
246-
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透(仅限 DD Windows)
247-
- `--hold 2` DD 结束后不重启,此时可以 SSH 登录修改系统内容,Windows 系统会挂载在 `/os`,Linux 系统**不会**自动挂载
249+
- `--frpc-toml PATH` 添加 frpc 内网穿透(仅限 DD Windows),参数填本地路径或 HTTP 链接
250+
- `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性
251+
- `--hold 2` DD 结束后不重启,用于 SSH 登录修改系统内容,Windows 系统会挂载在 `/os`,Linux 系统**不会**自动挂载
248252

249253
> [!TIP]
254+
>
250255
> 可通过多种方式(SSH、HTTP 80 端口、商家后台 VNC、串行控制台)查看安装进度。
251-
> <br />即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
256+
>
257+
> 即使安装过程出错,也能连接 SSH 手动救砖
258+
>
259+
> 也可以运行 `/trans.sh alpine` 自动救砖成 Alpine 系统。
252260
253261
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Live OS(内存系统)
254262

255263
- 可用 ssh 连接,进行备份/恢复硬盘、手动 DD、修改分区、手动安装 Alpine 等操作
256-
- 用户名 `root` 默认密码 `123@@@`
264+
- 用户名为 `root`,脚本会提示输入密码,不输入则使用随机密码
257265

258266
> [!TIP]
259267
>
@@ -262,15 +270,15 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz"
262270
> 如果用户手动操作没有破坏原系统,再次重启将回到原系统
263271
264272
```bash
265-
bash reinstall.sh alpine --hold=1
273+
bash reinstall.sh alpine --hold 1
266274
```
267275

268276
#### 可选参数
269277

270278
- `--password PASSWORD` 设置密码
271279
- `--ssh-port PORT` 修改 SSH 端口
272280
- `--ssh-key KEY` 设置 SSH 登录公钥,[格式如下](#--ssh-key)。当使用公钥时,密码为空
273-
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透
281+
- `--frpc-toml PATH` 添加 frpc 内网穿透,参数填本地路径或 HTTP 链接
274282

275283
### 功能 4: 重启到 <img width="16" height="16" src="https://netboot.xyz/img/favicon.ico" /> netboot.xyz
276284

@@ -298,10 +306,11 @@ bash reinstall.sh netboot.xyz
298306
>
299307
> 数据无价,请三思而后行!
300308
301-
- 用户名 `administrator` 默认密码 `123@@@`
309+
- 用户名为 `administrator`,脚本会提示输入密码,不输入则使用随机密码
302310
- 如果远程登录失败,可以尝试使用用户名 `.\administrator`
303311
- 静态机器会自动配置好 IP,可能首次开机几分钟后才生效
304-
- 支持所有语言
312+
- 支持任意语言的 ISO
313+
- 支持绕过 Windows 11 硬件限制
305314

306315
#### 支持的系统
307316

@@ -401,7 +410,6 @@ bash reinstall.sh windows \
401410
- <https://www.microsoft.com/software-download/windows11>
402411
- <https://www.microsoft.com/software-download/windows11arm64>
403412
- 评估版
404-
- <https://www.microsoft.com/evalcenter/download-windows-10-enterprise>
405413
- <https://www.microsoft.com/evalcenter/download-windows-11-enterprise>
406414
- <https://www.microsoft.com/evalcenter/download-windows-11-iot-enterprise-ltsc-eval>
407415
- <https://www.microsoft.com/evalcenter/download-windows-server-2012-r2>
@@ -425,8 +433,9 @@ bash reinstall.sh windows \
425433
- `--add-driver INF_OR_DIR` 添加额外驱动,填写 .inf 路径,或者 .inf 所在的文件夹
426434
- 需先下载驱动到当前系统
427435
- 可多次设置该参数以添加不同的驱动
428-
- `--frpc-toml /path/to/frpc.toml` 添加 frpc 内网穿透
429-
- `--hold 2` 在进入 Windows 官方安装程序之前,可以 SSH 登录修改硬盘内容,硬盘挂载在 `/os`
436+
- `--frpc-toml PATH` 添加 frpc 内网穿透,参数填本地路径或 HTTP 链接
437+
- `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性
438+
- `--hold 2` 用于在进入 Windows 官方安装程序之前,SSH 登录修改 `boot.wim``install.wim` 或者其它内容,硬盘挂载在 `/os`
430439

431440
#### 以下驱动会自动按需下载安装,无需手动添加
432441

@@ -488,20 +497,26 @@ Windows Server 2025 SERVERDATACENTER
488497
> Vista (Server 2008) 和 32 位系统可能会缺少驱动
489498
490499
> [!WARNING]
491-
> 未开启 CSM 的 EFI 机器,无法安装 Windows 7 (Server 2008 R2)
492500
>
493-
> Hyper-V (Azure) 需选择合适的虚拟机代系 <https://learn.microsoft.com/windows-server/virtualization/hyper-v/plan/should-i-create-a-generation-1-or-2-virtual-machine-in-hyper-v>
501+
> 安装 Windows 7 (Server 2008 R2) 时
502+
>
503+
> 1. EFI 引导的机器要开启 CSM
504+
>
505+
> 2. Hyper-V (Azure) 需选择第 1 代虚拟机 <https://learn.microsoft.com/windows-server/virtualization/hyper-v/plan/should-i-create-a-generation-1-or-2-virtual-machine-in-hyper-v>
494506
495507
> [!WARNING]
508+
>
496509
> Windows 10 LTSC 2021 中文版镜像 `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso``wsappx` 进程会长期占用 CPU
497510
>
498511
> 解决方法是更新系统补丁,或者手动安装 `VCLibs`<https://www.google.com/search?q=ltsc+wsappx>
499512
500513
> [!WARNING]
514+
>
501515
> 在 GCP 上安装 `2022年5月` 和之后发布的 Windows ISO,在引导 Windows 安装界面 (PE) 时会不断反复重启。解决方法如下,二选一
502516
>
503517
> 1. 添加 `--force-boot-mode bios` 参数,脚本将以 `BIOS 引导 + MBR 分区表` 方式安装 Windows
504-
> <br /> - (可选) 安装完成后用 `MBR2GPT /convert /allowFullOS` 命令转为 `EFI 引导 + GPT 分区表`
518+
>
519+
> (可选) 安装完成后用 `MBR2GPT /convert /allowFullOS` 命令转为 `EFI 引导 + GPT 分区表`
505520
>
506521
> 2. 自制 RAW 镜像并通过 DD 安装
507522
@@ -551,7 +566,7 @@ Windows Server 2025 SERVERDATACENTER
551566

552567
根据 Bug 守恒定律,修复旧 Bug 的同时会引入新的 Bug
553568

554-
如果遇到这种情况,可以尝试使用旧版本
569+
如果遇到新的 Bug,可以试下旧版本是否正常
555570

556571
<https://github.com/bin456789/reinstall/commits/main> 右侧找到旧版本的 `commit_id`
557572

debian.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
# 需要留意 kali initrd 自带的 /preseed.cfg
77

88
# 下面这行语句无效,因为本行后面有反斜杠,前面有空格(安装器认为不算注释)\
9-
d-i debian-installer/locale string en_US
9+
d-i debian-installer/locale string en_US.UTF-8
1010

1111
# B.4.1. 本地化
12-
d-i debian-installer/locale string en_US
12+
d-i debian-installer/locale string en_US.UTF-8
1313
d-i keyboard-configuration/xkb-keymap select us
1414

1515
# B.4.2. 网络设置
@@ -76,6 +76,7 @@ d-i partman-auto/expert_recipe_efi string efi :: \
7676
1 1 -1 $default_filesystem \
7777
method{ format } format{ } use_filesystem{ } $default_filesystem{ } mountpoint{ / } .
7878

79+
# 大于 2T 会自动用 gpt
7980
# shellcheck disable=SC1083,SC2086,SC2154
8081
d-i partman-auto/expert_recipe_bios string bios :: \
8182
1 1 1 free \

frpc-example.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
serverAddr = "YOUR_FRP_SERVER_IP"
1+
serverAddr = "11.22.33.44"
22
serverPort = 7000
3-
auth.token = "YOUR_FRP_TOKEN"
3+
auth.token = "123456"
44

55
[[proxies]]
66
name = "ssh"

get-frpc-url.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ is_in_china() {
1010
}
1111

1212
is_ipv6_only() {
13-
! grep -q 1 /dev/netconf/eth*/ipv4_has_internet
13+
! grep -q 1 /dev/netconf/*/ipv4_has_internet
1414
}
1515

1616
get_frpc_url() {

initrd-network.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,17 @@ test_connect() {
240240
test_internet() {
241241
for i in $(seq 5); do
242242
echo "Testing Internet Connection. Test $i... "
243-
if is_need_test_ipv4 && { local current_ipv4_addr; current_ipv4_addr="$(get_first_ipv4_addr | remove_netmask)"; test_connect "$current_ipv4_addr" "$ipv4_dns1" >/dev/null 2>&1 || test_connect "$current_ipv4_addr" "$ipv4_dns2" >/dev/null 2>&1; }; then
243+
if is_need_test_ipv4 &&
244+
current_ipv4_addr="$(get_first_ipv4_addr | remove_netmask)" &&
245+
{ test_connect "$current_ipv4_addr" "$ipv4_dns1" ||
246+
test_connect "$current_ipv4_addr" "$ipv4_dns2"; } >/dev/null 2>&1; then
244247
echo "IPv4 has internet."
245248
ipv4_has_internet=true
246249
fi
247-
if is_need_test_ipv6 && { local current_ipv6_addr; current_ipv6_addr="$(get_first_ipv6_addr | remove_netmask)"; test_connect "$current_ipv6_addr" "$ipv6_dns1" >/dev/null 2>&1 || test_connect "$current_ipv6_addr" "$ipv6_dns2" >/dev/null 2>&1; }; then
250+
if is_need_test_ipv6 &&
251+
current_ipv6_addr="$(get_first_ipv6_addr | remove_netmask)" &&
252+
{ test_connect "$current_ipv6_addr" "$ipv6_dns1" ||
253+
test_connect "$current_ipv6_addr" "$ipv6_dns2"; } >/dev/null 2>&1; then
248254
echo "IPv6 has internet."
249255
ipv6_has_internet=true
250256
fi

0 commit comments

Comments
 (0)