mirror of
https://github.com/bin456789/reinstall.git
synced 2026-04-25 07:24:17 +08:00
Compare commits
2 Commits
f0b3a475fc
...
57542c4cbf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57542c4cbf | ||
|
|
9a264250f1 |
33
reinstall.sh
33
reinstall.sh
@@ -486,11 +486,10 @@ fix_file_type() {
|
|||||||
-e 's/[,;#]//g' \
|
-e 's/[,;#]//g' \
|
||||||
-e 's/^[[:space:]]*//' \
|
-e 's/^[[:space:]]*//' \
|
||||||
-e 's/(POSIX|Unicode|UTF-8|ASCII)//gi' \
|
-e 's/(POSIX|Unicode|UTF-8|ASCII)//gi' \
|
||||||
-e 's/^DOS\/MBR boot sector/raw/i' \
|
-e 's/DOS\/MBR boot sector/raw/i' \
|
||||||
-e 's/^x86 boot sector/raw/i' \
|
-e 's/x86 boot sector/raw/i' \
|
||||||
-e 's/^Zstandard/zstd/i' \
|
-e 's/Zstandard/zstd/i' \
|
||||||
-e 's/^UDF/iso/i' \
|
-e 's/Windows imaging \(WIM\) image/wim/i' |
|
||||||
-e 's/^Windows imaging \(WIM\) image/wim/i' |
|
|
||||||
awk '{print $1}' | to_lower
|
awk '{print $1}' | to_lower
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1687,20 +1686,18 @@ Continue with DD?
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$iso" ]; then
|
# 对于同一行有多个成功匹配,grep -m1 无效
|
||||||
# 对于同一行有多个成功匹配,grep -m1 无效
|
iso=$(curl -L "https://fnnas.com/download$([ "$basearch" = aarch64 ] && echo -arm)" |
|
||||||
iso=$(curl -L "https://fnnas.com/download$([ "$basearch" = aarch64 ] && echo -arm)" |
|
grep -o 'https://[^"]*\.iso' | head -1 | grep .)
|
||||||
grep -o 'https://[^"]*\.iso' | head -1 | grep .)
|
|
||||||
|
|
||||||
# curl 7.82.0+
|
# curl 7.82.0+
|
||||||
# curl -L --json '{"url":"'$iso'"}' https://www.fnnas.com/api/download-sign
|
# curl -L --json '{"url":"'$iso'"}' https://www.fnnas.com/api/download-sign
|
||||||
|
|
||||||
iso=$(curl -L \
|
iso=$(curl -L \
|
||||||
-d '{"url":"'$iso'"}' \
|
-d '{"url":"'$iso'"}' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
https://www.fnnas.com/api/download-sign |
|
https://www.fnnas.com/api/download-sign |
|
||||||
grep -o 'https://[^"]*')
|
grep -o 'https://[^"]*')
|
||||||
fi
|
|
||||||
|
|
||||||
test_url "$iso" iso
|
test_url "$iso" iso
|
||||||
eval "${step}_iso='$iso'"
|
eval "${step}_iso='$iso'"
|
||||||
@@ -4229,7 +4226,7 @@ remove_exist_reinstall() {
|
|||||||
|
|
||||||
# 删除 reinstall 条目
|
# 删除 reinstall 条目
|
||||||
if [ -f "$target_cfg" ]; then
|
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
|
fi
|
||||||
|
|
||||||
# 清除 next entry
|
# 清除 next entry
|
||||||
|
|||||||
15
trans.sh
15
trans.sh
@@ -6063,14 +6063,13 @@ install_windows() {
|
|||||||
boot_dir=/os
|
boot_dir=/os
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 复制 iso 根目录 boot 开头的文件
|
# 复制启动相关的文件
|
||||||
|
# efi 额外复制efi目录
|
||||||
echo 'Copying boot files...'
|
echo 'Copying boot files...'
|
||||||
find /iso -maxdepth 1 -iname 'boot*' -exec cp -r {} "$boot_dir" \;
|
cp -r "$(get_path_in_correct_case /iso/boot)"* $boot_dir
|
||||||
|
|
||||||
# efi 额外复制 iso 根目录 efi 文件夹
|
|
||||||
if is_efi; then
|
if is_efi; then
|
||||||
echo 'Copying efi files...'
|
echo 'Copying efi files...'
|
||||||
find /iso -maxdepth 1 -type d -iname efi -exec cp -r {} "$boot_dir" \;
|
cp -r "$(get_path_in_correct_case /iso/efi)" $boot_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 复制iso全部文件(除了boot.wim)到installer分区
|
# 复制iso全部文件(除了boot.wim)到installer分区
|
||||||
@@ -7186,12 +7185,12 @@ EOF
|
|||||||
# 或者用 ms-sys
|
# 或者用 ms-sys
|
||||||
apk add grub-bios
|
apk add grub-bios
|
||||||
# efi 下,强制安装 mbr 引导,需要添加 --target i386-pc
|
# efi 下,强制安装 mbr 引导,需要添加 --target i386-pc
|
||||||
grub-install --target i386-pc --boot-directory="$(get_path_in_correct_case /os/boot)" /dev/$xda
|
grub-install --target i386-pc --boot-directory=/os/boot /dev/$xda
|
||||||
cat <<EOF >"$(get_path_in_correct_case /os/boot/grub/grub.cfg)"
|
cat <<EOF >/os/boot/grub/grub.cfg
|
||||||
set timeout=5
|
set timeout=5
|
||||||
menuentry "reinstall" {
|
menuentry "reinstall" {
|
||||||
search --no-floppy --label --set=root os
|
search --no-floppy --label --set=root os
|
||||||
ntldr /$(cd /os && get_path_in_correct_case bootmgr)
|
ntldr /bootmgr
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user