Unverified Commit 8fc3a1dc authored by K900's avatar K900 Committed by GitHub
Browse files

Merge pull request #211218 from ncfavier/fix-install-mount

nixos-install: only mount if root
parents 0303fd94 cd4f1a1d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -193,9 +193,11 @@ touch "$mountPoint/etc/NIXOS"
# the root with `nixos-enter`.
# Without this the bootloader installation may fail due to options that
# contain paths referenced during evaluation, like initrd.secrets.
if (( EUID == 0 )); then
    mount --rbind --mkdir "$mountPoint" "$mountPoint$mountPoint"
    mount --make-rslave "$mountPoint$mountPoint"
    trap 'umount -R "$mountPoint$mountPoint" && rmdir "$mountPoint$mountPoint"' EXIT
fi

# Switch to the new system configuration.  This will install Grub with
# a menu default pointing at the kernel/initrd/etc of the new