nixos-install: fix removal of non-empty /mnt

After building the target system, `nixos-install` tries to remove `/mnt`
on the target filesystem. And the script may fail without any explanation,
if `/mnt` isn't empty.

This commit makes the installation process carry on even if there are
files under `/mnt`.

See https://github.com/NixOS/nixpkgs/issues/244643.
This commit is contained in:
Andrey Krainyak 2023-08-02 16:37:22 +08:00
parent 3580ac6c65
commit d61cc625fa
No known key found for this signature in database
GPG Key ID: 2AE7DB5FB4F3902A

View File

@ -206,7 +206,7 @@ if [[ -z $noBootLoader ]]; then
mount --rbind --mkdir / "$mountPoint"
mount --make-rslave "$mountPoint"
/run/current-system/bin/switch-to-configuration boot
umount -R "$mountPoint" && rmdir "$mountPoint"
umount -R "$mountPoint" && (rmdir "$mountPoint" 2>/dev/null || true)
EOF
)"
fi