nixos-install: only mount if root
This commit is contained in:
parent
682381bf3f
commit
cd4f1a1df5
8
nixos/modules/installer/tools/nixos-install.sh
Normal file → Executable file
8
nixos/modules/installer/tools/nixos-install.sh
Normal file → Executable file
|
@ -193,9 +193,11 @@ touch "$mountPoint/etc/NIXOS"
|
||||||
# the root with `nixos-enter`.
|
# the root with `nixos-enter`.
|
||||||
# Without this the bootloader installation may fail due to options that
|
# Without this the bootloader installation may fail due to options that
|
||||||
# contain paths referenced during evaluation, like initrd.secrets.
|
# contain paths referenced during evaluation, like initrd.secrets.
|
||||||
mount --rbind --mkdir "$mountPoint" "$mountPoint$mountPoint"
|
if (( EUID == 0 )); then
|
||||||
mount --make-rslave "$mountPoint$mountPoint"
|
mount --rbind --mkdir "$mountPoint" "$mountPoint$mountPoint"
|
||||||
trap 'umount -R "$mountPoint$mountPoint" && rmdir "$mountPoint$mountPoint"' EXIT
|
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
|
# Switch to the new system configuration. This will install Grub with
|
||||||
# a menu default pointing at the kernel/initrd/etc of the new
|
# a menu default pointing at the kernel/initrd/etc of the new
|
||||||
|
|
Loading…
Reference in a new issue