From d2c97b4d3a7d66efbfd0bf5173713c54ba313198 Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Sun, 3 Sep 2017 23:09:52 +0300 Subject: [PATCH] install-linux: Adding HOME checks --- scripts/install-nix-from-closure.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh index 3e5676f419b..377d5a46801 100644 --- a/scripts/install-nix-from-closure.sh +++ b/scripts/install-nix-from-closure.sh @@ -22,6 +22,31 @@ if [ -z "$HOME" ]; then exit 1 fi +if [ ! -e "$HOME" ]; then + echo "$0: Home directory $HOME does not exist" >&2 + exit 1 +fi + +if [ ! -d "$HOME" ]; then + echo "$0: Home directory $HOME is not a directory" >&2 + exit 1 +fi + +if [ ! -w "$HOME" ]; then + echo "$0: Home directory $HOME is not writable for user $USER. No deal" >&2 + exit 1 +fi + +if [ ! -O "$HOME" ]; then + echo "$0: Home directory $HOME is not owned by user $USER, users HOME probably must be owned by user" >&2 + exit 1 +fi + +if [ ! -x "$HOME" ]; then + echo "$0: Home directory $HOME is not marked as executable for user $USER, how we are going to go into it?" >&2 + exit 1 +fi + # macOS support for 10.10 or higher if [ "$(uname -s)" = "Darwin" ]; then if [ $(($(sw_vers -productVersion | cut -d '.' -f 2))) -lt 10 ]; then