mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
core: 修复了无法找到 autofs 挂载的 efi 分区
This commit is contained in:
parent
0c74b5783d
commit
26811638f5
30
reinstall.sh
30
reinstall.sh
@ -965,8 +965,8 @@ add_efi_entry_in_windows() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_maybe_efi_dirs_in_linux() {
|
get_maybe_efi_dirs_in_linux() {
|
||||||
# arch云镜像efi分区挂载在/efi
|
# arch云镜像efi分区挂载在/efi,且使用 autofs,挂载后会有两个 /efi 条目
|
||||||
mount | awk '$5=="vfat" {print $3}' | grep -E '/boot|/efi'
|
mount | awk '$5=="vfat" || $5=="autofs" {print $3}' | grep -E '/boot|/efi' | sort | uniq
|
||||||
}
|
}
|
||||||
|
|
||||||
get_disk_by_part() {
|
get_disk_by_part() {
|
||||||
@ -980,6 +980,10 @@ get_part_num_by_part() {
|
|||||||
grep -o '[0-9]*' <<<"$dev_part" | tail -1
|
grep -o '[0-9]*' <<<"$dev_part" | tail -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grep_efi_index() {
|
||||||
|
awk -F '*' '{print $1}' | sed 's/Boot//'
|
||||||
|
}
|
||||||
|
|
||||||
add_efi_entry_in_linux() {
|
add_efi_entry_in_linux() {
|
||||||
source=$1
|
source=$1
|
||||||
|
|
||||||
@ -997,15 +1001,23 @@ add_efi_entry_in_linux() {
|
|||||||
cp -f "$source" "$dist_dir/$basename"
|
cp -f "$source" "$dist_dir/$basename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# disk=$($grub-probe -t device "$dist")
|
if false; then
|
||||||
install_pkg findmnt
|
grub_probe="$(command -v grub-probe grub2-probe)"
|
||||||
dev_part=$(findmnt -T "$dist_dir" -no SOURCE)
|
dev_part="$("$grub_probe" -t device "$dist_dir")"
|
||||||
efibootmgr --quiet --create-only \
|
else
|
||||||
|
install_pkg findmnt
|
||||||
|
# arch findmnt 会得到
|
||||||
|
# systemd-1
|
||||||
|
# /dev/sda2
|
||||||
|
dev_part=$(findmnt -T "$dist_dir" -no SOURCE | grep '^/dev/')
|
||||||
|
fi
|
||||||
|
|
||||||
|
id=$(efibootmgr --create-only \
|
||||||
--disk "/dev/$(get_disk_by_part $dev_part)" \
|
--disk "/dev/$(get_disk_by_part $dev_part)" \
|
||||||
--part "$(get_part_num_by_part $dev_part)" \
|
--part "$(get_part_num_by_part $dev_part)" \
|
||||||
--label "$(get_entry_name)" \
|
--label "$(get_entry_name)" \
|
||||||
--loader "\\EFI\\reinstall\\$basename"
|
--loader "\\EFI\\reinstall\\$basename" |
|
||||||
id=$(efibootmgr | grep "$(get_entry_name)" | awk -F '*' '{print $1}' | sed 's/Boot//')
|
tail -1 | grep_efi_index)
|
||||||
efibootmgr --bootnext $id
|
efibootmgr --bootnext $id
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -1464,7 +1476,7 @@ if is_efi; then
|
|||||||
|
|
||||||
install_pkg efibootmgr
|
install_pkg efibootmgr
|
||||||
efibootmgr | grep -q 'BootNext:' && efibootmgr --quiet --delete-bootnext
|
efibootmgr | grep -q 'BootNext:' && efibootmgr --quiet --delete-bootnext
|
||||||
efibootmgr | grep 'reinstall' | awk -F '*' '{print $1}' | sed 's/Boot//' |
|
efibootmgr | grep 'reinstall' | grep_efi_index |
|
||||||
xargs -I {} efibootmgr --quiet --bootnum {} --delete-bootnum
|
xargs -I {} efibootmgr --quiet --bootnum {} --delete-bootnum
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user