mirror of
https://github.com/elitak/nixos-infect.git
synced 2024-12-23 00:28:28 +03:00
explicitly check for ESP mount
This commit is contained in:
parent
5ef3f953d3
commit
2ac3dd4bd7
1 changed files with 4 additions and 5 deletions
|
@ -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)"
|
||||||
else
|
if ! isEFI; then
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue