From ad0dc41899cafb8ee8afc73856d3a86ec3fa0240 Mon Sep 17 00:00:00 2001 From: Alex Cruice Date: Mon, 25 May 2015 14:49:44 +1000 Subject: [PATCH] Check shell profile is writeable before modifying The `set -e` at the top of the script causes the installation to fail to complete if the shell profile is not writeable. Checking file existence only is not enough. --- scripts/install-nix-from-closure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh index 3efe7b384..465cc1013 100644 --- a/scripts/install-nix-from-closure.sh +++ b/scripts/install-nix-from-closure.sh @@ -92,7 +92,7 @@ p=$NIX_LINK/etc/profile.d/nix.sh added= for i in .bash_profile .bash_login .profile; do fn="$HOME/$i" - if [ -e "$fn" ]; then + if [ -w "$fn" ]; then if ! grep -q "$p" "$fn"; then echo "modifying $fn..." >&2 echo "if [ -e $p ]; then . $p; fi # added by Nix installer" >> $fn