From bb030ece3b4dc6ca892907927345e8d109e42678 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 7 Feb 2018 17:23:05 +0100 Subject: [PATCH] nixos-enter: Check whether --root denotes a NixOS installation --- nixos/modules/installer/tools/nixos-enter.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/installer/tools/nixos-enter.sh b/nixos/modules/installer/tools/nixos-enter.sh index 96b6a017b810..fcd0c54f5db9 100644 --- a/nixos/modules/installer/tools/nixos-enter.sh +++ b/nixos/modules/installer/tools/nixos-enter.sh @@ -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"