File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ bash reinstall.sh netboot.xyz
331331- If remote login fails, try using the username ` .\administrator ` .
332332- The machine with a static IP will automatically configure the IP. It may take a few minutes to take effect on the first boot.
333333- Supports ISO images in any language.
334- - Supports bypassing Windows 11 hardware requirements.
334+ - Automatically bypassing Windows 11 hardware requirements.
335335
336336#### Supported Systems
337337
@@ -582,12 +582,14 @@ bash reinstall.sh reset
582582
583583According to the Law of Bug Conservation, fixing old bugs often introduces new ones.
584584
585- If a new bug occurs, try using an older version to see if it works.
585+ If a bug occurs, try using an older version to see if it works.
586586
587587Go to < https://github.com/bin456789/reinstall/commits/main > and find the old version’s ` commit_id ` on the right side.
588588
589+ Replace ` xxxxxxxx ` in the script below with the ` commit_id ` of an older version and run the script.
590+
589591``` bash
590- commit_id=xxxxxxx
592+ commit_id=xxxxxxxx
591593curl -O https://raw.githubusercontent.com/bin456789/reinstall/$commit_id /reinstall.sh || wget -O ${_##*/ } $_
592594sed -i " /^confhome.*main$/s/main/$commit_id /" reinstall.sh
593595bash reinstall.sh ...
@@ -598,6 +600,7 @@ bash reinstall.sh ...
5986001 . Fork this repository.
5996012 . Modify the ` confhome ` and ` confhome_cn ` at the beginning of ` reinstall.sh ` and ` reinstall.bat ` .
6006023 . Make changes to the other code.
603+ 4 . Download and run your ` reinstall.sh ` or ` reinstall.bat ` ."
601604
602605## Thanks
603606
Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ bash reinstall.sh netboot.xyz
331331- 如果远程登录失败,可以尝试使用用户名 ` .\administrator `
332332- 静态机器会自动配置好 IP,可能首次开机几分钟后才生效
333333- 支持任意语言的 ISO
334- - 支持绕过 Windows 11 硬件限制
334+ - 自动绕过 Windows 11 硬件限制
335335
336336#### 支持的系统
337337
@@ -582,12 +582,14 @@ bash reinstall.sh reset
582582
583583根据 Bug 守恒定律,修复旧 Bug 的同时会引入新的 Bug
584584
585- 如果遇到新的 Bug ,可以试下旧版本是否正常
585+ 如果脚本出现问题 ,可以试下旧版本是否正常
586586
587587从 < https://github.com/bin456789/reinstall/commits/main > 右侧找到旧版本的 ` commit_id `
588588
589+ 将下面脚本的 ` xxxxxxxx ` 替换成旧版本的 ` commit_id ` 并运行脚本
590+
589591``` bash
590- commit_id=xxxxxxx
592+ commit_id=xxxxxxxx
591593curl -O https://raw.githubusercontent.com/bin456789/reinstall/$commit_id /reinstall.sh || wget -O ${_##*/ } $_
592594sed -i " /^confhome.*main$/s/main/$commit_id /" reinstall.sh
593595bash reinstall.sh ...
@@ -598,6 +600,7 @@ bash reinstall.sh ...
5986001 . Fork 本仓库
5996012 . 修改 ` reinstall.sh ` 和 ` reinstall.bat ` 开头的 ` confhome ` 和 ` confhome_cn `
6006023 . 修改其它代码
603+ 4 . 下载并运行你的 ` reinstall.sh ` 或 ` reinstall.bat `
601604
602605## 感谢
603606
Original file line number Diff line number Diff line change @@ -702,12 +702,6 @@ is_virt() {
702702 $_is_virt
703703}
704704
705- is_absolute_path () {
706- # 检查路径是否以/开头
707- # 注意语法和 ash 不同
708- [[ " $1 " = /* ]]
709- }
710-
711705is_cpu_supports_x86_64_v3 () {
712706 # 用 ld.so/cpuid/coreinfo.exe 更准确
713707 # centos 7 /usr/lib64/ld-linux-x86-64.so.2 没有 --help
@@ -3229,7 +3223,7 @@ build_cmdline() {
32293223
32303224# 脚本可能多次运行,先清理之前的残留
32313225mkdir_clear () {
3232- dir=$1
3226+ local dir=$1
32333227
32343228 if [ -z " $dir " ] || [ " $dir " = / ]; then
32353229 return
@@ -3892,6 +3886,7 @@ This script is outdated, please download reinstall.sh again.
38923886
38933887 if [ " $hold " = 0 ]; then
38943888 info ' hold 0'
3889+ echo " Edit $tmp if needed."
38953890 read -r -p ' Press Enter to continue...'
38963891 fi
38973892
Original file line number Diff line number Diff line change @@ -5738,10 +5738,15 @@ get_filesize_mb() {
57385738 du -m " $1 " | awk ' {print $1}'
57395739}
57405740
5741- is_absolute_path () {
5742- # 检查路径是否以/开头
5743- # 注意语法和 bash 不同
5744- [[ " $1 " = " /*" ]]
5741+ mkdir_clear () {
5742+ local dir=$1
5743+
5744+ if [ -z " $dir " ] || [ " $dir " = / ]; then
5745+ return
5746+ fi
5747+
5748+ rm -rf " $dir "
5749+ mkdir -p " $dir "
57455750}
57465751
57475752# 注意使用方法是 list=$(list_add "$list" "$item_to_add")
@@ -6014,7 +6019,7 @@ install_windows() {
60146019 # 检测 sac 和 nvme
60156020 {
60166021 find_file_ignore_case /wim/Windows/System32/sacsess.exe && has_sac=true || has_sac=false
6017- find_file_ignore_case /wim/Windows/INF/ stornvme.inf && has_stornvme=true || has_stornvme=false
6022+ find_file_ignore_case /wim/Windows/System32/drivers/ stornvme.sys && has_stornvme=true || has_stornvme=false
60186023 } > /dev/null 2>&1
60196024
60206025 # 检测是否支持 sha256 签名的驱动
@@ -6234,8 +6239,9 @@ install_windows() {
62346239 add_drivers () {
62356240 info " Add drivers"
62366241
6242+ # 驱动下载临时文件夹
62376243 drv=/os/drivers
6238- mkdir -p " $drv " # 驱动下载临时文件夹
6244+ mkdir_clear " $drv "
62396245
62406246 # 这里有坑
62416247 # $(get_cloud_vendor) 调用了 cache_dmi_and_virt
@@ -6743,8 +6749,7 @@ EOF
67436749 cp_drivers $drv /virtio -ipath " */$virtio_sys /$arch /*" " $@ "
67446750 fi
67456751 else
6746- # coreutils 的 cp mv rm 才有 -v 参数
6747- apk add 7zip file coreutils
6752+ apk add 7zip file
67486753 download $baseurl /$dir /virtio-win-gt-$arch_xdd .msi $drv /virtio.msi
67496754 match=" FILE_*_${virtio_sys} _${arch} *"
67506755 7z x $drv /virtio.msi -o$drv /virtio -i! $match -y -bb1
Original file line number Diff line number Diff line change 11#! /bin/ash
22# shellcheck shell=dash
3- # shellcheck disable=SC3001,SC3003,SC3010
3+ # shellcheck disable=SC3001,SC3003,SC3010,SC3015
44# reinstall.sh / trans.sh 共用此文件
55
66# grep 无法处理 UTF-16LE 编码的 inf,有以下几种解决方法
@@ -239,6 +239,27 @@ list_files_from_inf() {
239239 done < <( echo " $inf_txts " )
240240}
241241
242+ is_x_starts_with_y () {
243+ [[ " $1 " =~ ^" $2 " ]]
244+ }
245+
246+ is_x_ends_with_y () {
247+ [[ " $1 " =~ " $2 " $ ]]
248+ }
249+
250+ is_absolute_path () {
251+ # 检查路径是否以/开头
252+
253+ # alpine ash 可用
254+ # [[ "$1" = "/*" ]]
255+
256+ # bash 可用
257+ # [[ "$1" = /* ]]
258+
259+ # 都可用
260+ is_x_starts_with_y " $1 " /
261+ }
262+
242263# windows 安装驱动时,只会安装相同架构的驱动文件到系统,即使 inf 里有列出其它架构的驱动
243264# 因此 DISM 导出驱动时,也就没有包含其它架构的驱动文件
244265
@@ -284,7 +305,11 @@ get_path_in_correct_case() {
284305 output=" $output$part /"
285306 else
286307 # 最后 part
287- output=" $output$part "
308+ if is_x_ends_with_y " $path " /; then
309+ output=" $output$part /"
310+ else
311+ output=" $output$part "
312+ fi
288313 fi
289314 shift
290315 done
You can’t perform that action at this time.
0 commit comments