mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
Merge pull request #211218 from ncfavier/fix-install-mount
nixos-install: only mount if root
This commit is contained in:
commit
8fc3a1dcc9
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`.
|
||||
# Without this the bootloader installation may fail due to options that
|
||||
# contain paths referenced during evaluation, like initrd.secrets.
|
||||
mount --rbind --mkdir "$mountPoint" "$mountPoint$mountPoint"
|
||||
mount --make-rslave "$mountPoint$mountPoint"
|
||||
trap 'umount -R "$mountPoint$mountPoint" && rmdir "$mountPoint$mountPoint"' EXIT
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user