nixos-enter: Check whether --root denotes a NixOS installation

This commit is contained in:
Eelco Dolstra 2018-02-07 17:23:05 +01:00
parent f0979ca30e
commit bb030ece3b
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE

View File

@ -45,6 +45,11 @@ while [ "$#" -gt 0 ]; do
esac
done
if [[ ! -e $mountPoint/etc/NIXOS ]]; then
echo "$0: '$mountPoint' is not a NixOS installation" >&2
exit 126
fi
mkdir -m 0755 -p "$mountPoint/dev"
mount --rbind /dev "$mountPoint/dev"