debian: 修复重装后还残留着旧系统的 efi 文件 (debian-installer 的 bug)

This commit is contained in:
bin456789 2024-05-22 21:27:06 +08:00
parent b610c8b320
commit 135576e95c
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -62,15 +62,17 @@ d-i partman-basicfilesystems/no_swap boolean false
# 最小值 膨胀权重 最大值
# https://salsa.debian.org/installer-team/partman-auto/-/blob/master/recipes/atomic?ref_type=heads
# https://salsa.debian.org/installer-team/partman-auto/-/blob/master/recipes-amd64-efi/atomic?ref_type=heads
# shellcheck disable=SC1083,SC2086,SC2154
d-i partman-auto/expert_recipe_efi string efi :: \
106 1 106 free \
$iflabel{ gpt } $reusemethod{ } method{ efi } format{ } . \
$iflabel{ gpt } method{ efi } format{ } . \
1 1 -1 $default_filesystem \
method{ format } format{ } use_filesystem{ } $default_filesystem{ } mountpoint{ / } .
# shellcheck disable=SC1083,SC2086,SC2154
d-i partman-auto/expert_recipe_bios string bios :: \
1 1 1 free \
$iflabel{ gpt } $reusemethod{ } method{ biosgrub } . \
$iflabel{ gpt } method{ biosgrub } . \
1 1 -1 $default_filesystem \
method{ format } format{ } use_filesystem{ } $default_filesystem{ } mountpoint{ / } .
@ -108,7 +110,7 @@ d-i finish-install/reboot_in_progress note
# debian 11 initrd 没有 xargs awk
# debian 12 initrd 没有 xargs
d-i partman/early_command string \
# efi 分区大小未改变时,不会被格式化,因此需要手动删除旧系统的 efi 文件
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
swapfile=/target/swapfile; \
@ -123,7 +125,9 @@ d-i partman/early_command string \
echo "swapoff -a; rm -f $swapfile" >/usr/lib/finish-install.d/95swapoff; \
chmod a+x /usr/lib/finish-install.d/95swapoff; \
xda=$(wget --tries=5 $confhome/get-xda.sh -O- | sh -s); \
echo "rm -rf /target/boot/efi/*; $postinst.orig" >>$postinst; \
xda=$(wget --tries=5 "$confhome/get-xda.sh" -O- | sh -s); \
debconf-set partman-auto/disk "/dev/$xda"; \
debconf-set grub-installer/bootdev "/dev/$xda"; \
rm -rf /usr/sbin/fdisk /usr/sbin/sfdisk; \