explicitly check for ESP mount

This commit is contained in:
Keea 2024-07-03 19:39:49 -07:00
parent 5ef3f953d3
commit 2ac3dd4bd7

View file

@ -224,7 +224,7 @@ findESP() {
&& esp="$(df "$d" --output=source | sed 1d)" \ && esp="$(df "$d" --output=source | sed 1d)" \
&& break && break
done done
[[ -z "$esp" ]] && { echo "ERROR: No ESP mount point found"; return 1; } [[ -z "$esp" ]] && { echo "WARNING: No ESP mount point found"; return 1; }
for uuid in /dev/disk/by-uuid/*; do for uuid in /dev/disk/by-uuid/*; do
[[ $(readlink -f "$uuid") == "$esp" ]] && echo $uuid && return 0 [[ $(readlink -f "$uuid") == "$esp" ]] && echo $uuid && return 0
done done
@ -232,9 +232,8 @@ findESP() {
prepareEnv() { prepareEnv() {
# $esp and $grubdev are used in makeConf() # $esp and $grubdev are used in makeConf()
if isEFI; then esp="$(findESP)"
esp="$(findESP)" if ! isEFI; then
else
for grubdev in /dev/vda /dev/sda /dev/xvda /dev/nvme0n1 ; do [[ -e $grubdev ]] && break; done for grubdev in /dev/vda /dev/sda /dev/xvda /dev/nvme0n1 ; do [[ -e $grubdev ]] && break; done
fi fi
@ -371,7 +370,7 @@ infect() {
(cd / && ls etc/ssh/ssh_host_*_key* || true) >> /etc/NIXOS_LUSTRATE (cd / && ls etc/ssh/ssh_host_*_key* || true) >> /etc/NIXOS_LUSTRATE
rm -rf /boot.bak rm -rf /boot.bak
isEFI && umount "$esp" [[ -z "$esp" ]] || umount "$esp"
mv -v /boot /boot.bak || { cp -a /boot /boot.bak ; rm -rf /boot/* ; umount /boot ; } mv -v /boot /boot.bak || { cp -a /boot /boot.bak ; rm -rf /boot/* ; umount /boot ; }
if isEFI; then if isEFI; then