From 84b5340762ef8489a1413e084b7c1088aa3a1db4 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 3 Sep 2017 11:29:01 -0700 Subject: [PATCH] install: be better and finding stack when just installed and not in PATH --- hledger-install/hledger-install.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hledger-install/hledger-install.sh b/hledger-install/hledger-install.sh index ecbfbca3c..48d349264 100755 --- a/hledger-install/hledger-install.sh +++ b/hledger-install/hledger-install.sh @@ -522,7 +522,9 @@ install_from_bindist() { echo "Stack has been installed to: $HOME_LOCAL_BIN/stack" info "" - check_usr_local_bin_on_path +#CHANGED +# check_usr_local_bin_on_path + ensure_home_local_bin_on_path } install_arm_binary() { @@ -690,6 +692,16 @@ check_home_local_bin_on_path() { fi } +# If ~/.local/bin is not on the PATH, print a warning and add it temporarily. +ensure_home_local_bin_on_path() { + if ! on_path "$HOME_LOCAL_BIN" ; then + info "WARNING: '$HOME_LOCAL_BIN' is not on your PATH; adding it temporarily." + info " For best results, please add it to the beginning of PATH in your profile." + info "" + PATH=$HOME_LOCAL_BIN:$PATH + fi +} + # Check whether /usr/local/bin is on the PATH, and print a warning if not. check_usr_local_bin_on_path() { if ! on_path "$USR_LOCAL_BIN" ; then @@ -719,6 +731,7 @@ ensure_stack() { if ! $(has_stack) || [[ "$FORCE" == "true" ]] ; then echo "Installing stack" do_os + # after installing stack, it will fi }