diff options
author | Naïm Favier <n@monade.li> | 2023-01-17 11:39:34 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2023-01-17 11:39:34 +0100 |
commit | cd4f1a1df502f10a8494c5305121b1b9c4d80f63 (patch) | |
tree | 3fd8c47eed8f8bedb67dc0aedd475f450545e4b6 /nixos/modules/installer | |
parent | 682381bf3f24c4d2ddeace757ce506c69b8f7c07 (diff) |
nixos-install: only mount if root
Diffstat (limited to 'nixos/modules/installer')
-rwxr-xr-x[-rw-r--r--] | nixos/modules/installer/tools/nixos-install.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh index 7247451a85d9c..9f609cefe6ead 100644..100755 --- a/nixos/modules/installer/tools/nixos-install.sh +++ b/nixos/modules/installer/tools/nixos-install.sh @@ -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 |