Compare commits

..

4 Commits

Author SHA1 Message Date
bin456789
f0b3a475fc windows: 修复 iso 里面文件大小写引起的引导问题
1. iso 里面的 boot 文件夹字母不是全小写,导致用 grub-install --boot-directory=/os/boot 安装后无法从 boot 文件夹读取模块
2. iso 里面的 boot bootmgr 的 boot 大小写不一致导致没有复制 bootmgr

fixes #568
2026-03-10 01:07:20 +08:00
bin456789
5e2f46444c fnos: 允许指定 iso 链接
fixes #567
2026-03-10 01:06:10 +08:00
bin456789
c784479408 core: 添加 reset 模式取消重装 2026-03-10 00:09:05 +08:00
bin456789
ca11ab5ef8 core: 不重要的更改 2026-03-10 00:09:05 +08:00
2 changed files with 26 additions and 22 deletions

View File

@@ -486,10 +486,11 @@ fix_file_type() {
-e 's/[,;#]//g' \
-e 's/^[[:space:]]*//' \
-e 's/(POSIX|Unicode|UTF-8|ASCII)//gi' \
-e 's/DOS\/MBR boot sector/raw/i' \
-e 's/x86 boot sector/raw/i' \
-e 's/Zstandard/zstd/i' \
-e 's/Windows imaging \(WIM\) image/wim/i' |
-e 's/^DOS\/MBR boot sector/raw/i' \
-e 's/^x86 boot sector/raw/i' \
-e 's/^Zstandard/zstd/i' \
-e 's/^UDF/iso/i' \
-e 's/^Windows imaging \(WIM\) image/wim/i' |
awk '{print $1}' | to_lower
}
@@ -1686,18 +1687,20 @@ Continue with DD?
fi
done
# 对于同一行有多个成功匹配grep -m1 无效
iso=$(curl -L "https://fnnas.com/download$([ "$basearch" = aarch64 ] && echo -arm)" |
grep -o 'https://[^"]*\.iso' | head -1 | grep .)
if [ -z "$iso" ]; then
# 对于同一行有多个成功匹配grep -m1 无效
iso=$(curl -L "https://fnnas.com/download$([ "$basearch" = aarch64 ] && echo -arm)" |
grep -o 'https://[^"]*\.iso' | head -1 | grep .)
# curl 7.82.0+
# curl -L --json '{"url":"'$iso'"}' https://www.fnnas.com/api/download-sign
# curl 7.82.0+
# curl -L --json '{"url":"'$iso'"}' https://www.fnnas.com/api/download-sign
iso=$(curl -L \
-d '{"url":"'$iso'"}' \
-H 'Content-Type: application/json' \
https://www.fnnas.com/api/download-sign |
grep -o 'https://[^"]*')
iso=$(curl -L \
-d '{"url":"'$iso'"}' \
-H 'Content-Type: application/json' \
https://www.fnnas.com/api/download-sign |
grep -o 'https://[^"]*')
fi
test_url "$iso" iso
eval "${step}_iso='$iso'"
@@ -4226,7 +4229,7 @@ remove_exist_reinstall() {
# 删除 reinstall 条目
if [ -f "$target_cfg" ]; then
sed -i "/^$BOOT_ENTEY_START_MARK/,/^$BOOT_ENTEY_END_MARK/d}" "$target_cfg"
sed -i "/^$BOOT_ENTEY_START_MARK/,/^$BOOT_ENTEY_END_MARK/d" "$target_cfg"
fi
# 清除 next entry

View File

@@ -6063,13 +6063,14 @@ install_windows() {
boot_dir=/os
fi
# 复制启动相关的文件
# efi 额外复制efi目录
# 复制 iso 根目录 boot 开头的文件
echo 'Copying boot files...'
cp -r "$(get_path_in_correct_case /iso/boot)"* $boot_dir
find /iso -maxdepth 1 -iname 'boot*' -exec cp -r {} "$boot_dir" \;
# efi 额外复制 iso 根目录 efi 文件夹
if is_efi; then
echo 'Copying efi files...'
cp -r "$(get_path_in_correct_case /iso/efi)" $boot_dir
find /iso -maxdepth 1 -type d -iname efi -exec cp -r {} "$boot_dir" \;
fi
# 复制iso全部文件(除了boot.wim)到installer分区
@@ -7185,12 +7186,12 @@ EOF
# 或者用 ms-sys
apk add grub-bios
# efi 下,强制安装 mbr 引导,需要添加 --target i386-pc
grub-install --target i386-pc --boot-directory=/os/boot /dev/$xda
cat <<EOF >/os/boot/grub/grub.cfg
grub-install --target i386-pc --boot-directory="$(get_path_in_correct_case /os/boot)" /dev/$xda
cat <<EOF >"$(get_path_in_correct_case /os/boot/grub/grub.cfg)"
set timeout=5
menuentry "reinstall" {
search --no-floppy --label --set=root os
ntldr /bootmgr
ntldr /$(cd /os && get_path_in_correct_case bootmgr)
}
EOF
fi