Suggest to create .bash_profile if it doesn't exist
This commit is contained in:
parent
42e8989d0b
commit
2e3968d500
@ -100,29 +100,42 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
|||||||
GHCUP_PROFILE_FILE="$HOME/.bashrc"
|
GHCUP_PROFILE_FILE="$HOME/.bashrc"
|
||||||
elif [ -f "$HOME/.bash_profile" ] ; then
|
elif [ -f "$HOME/.bash_profile" ] ; then
|
||||||
GHCUP_PROFILE_FILE="$HOME/.bash_profile"
|
GHCUP_PROFILE_FILE="$HOME/.bash_profile"
|
||||||
|
else
|
||||||
|
# most complaints we get are from mac users who
|
||||||
|
# need assistance of setting up their shell, so suggest
|
||||||
|
# to create .bash_profile, which is a good guess
|
||||||
|
GHCUP_PROFILE_FILE="$HOME/.bash_profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${GHCUP_PROFILE_FILE}" ] && [ -f "${GHCUP_PROFILE_FILE}" ] ; then
|
if [ -f "${GHCUP_PROFILE_FILE}" ] ; then
|
||||||
printf "\\033[0;35m%s\\033[0m\\n" ""
|
printf "\\033[0;35m%s\\033[0m\\n" ""
|
||||||
printf "\\033[0;35m%s\\033[0m\\n" "Detected \"${GHCUP_PROFILE_FILE}\" on your system..."
|
printf "\\033[0;35m%s\\033[0m\\n" "Detected \"${GHCUP_PROFILE_FILE}\" on your system..."
|
||||||
printf "\\033[0;35m%s\\033[0m\\n" "If you want ghcup to automatically fix your \"${GHCUP_PROFILE_FILE}\" to include the required PATH variable"
|
printf "\\033[0;35m%s\\033[0m\\n" "If you want ghcup to automatically fix your \"${GHCUP_PROFILE_FILE}\" to include the required PATH variable"
|
||||||
printf "\\033[0;35m%s\\033[0m\\n" "answer with YES, otherwise with NO and press ENTER."
|
printf "\\033[0;35m%s\\033[0m\\n" "answer with YES, otherwise with NO and press ENTER."
|
||||||
printf "\\033[0;35m%s\\033[0m\\n" ""
|
printf "\\033[0;35m%s\\033[0m\\n" ""
|
||||||
|
elif [ -n "${BASH}" ] ; then # only suggest to create .bash_profile if we are in a bash shell
|
||||||
while true; do
|
printf "\\033[0;35m%s\\033[0m\\n" ""
|
||||||
read -r next_answer </dev/tty
|
printf "\\033[0;35m%s\\033[0m\\n" "Detected bash shell on your system..."
|
||||||
|
printf "\\033[0;35m%s\\033[0m\\n" "If you want ghcup to automatically create \"${GHCUP_PROFILE_FILE}\" and include the required PATH variable"
|
||||||
case $next_answer in
|
printf "\\033[0;35m%s\\033[0m\\n" "answer with YES, otherwise with NO and press ENTER."
|
||||||
[Yy]*)
|
printf "\\033[0;35m%s\\033[0m\\n" ""
|
||||||
echo "source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" >> "${GHCUP_PROFILE_FILE}"
|
else
|
||||||
exit 0;;
|
exit 0
|
||||||
[Nn]*)
|
|
||||||
exit 0;;
|
|
||||||
*)
|
|
||||||
echo "Please type YES or NO and press enter.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -r next_answer </dev/tty
|
||||||
|
|
||||||
|
case $next_answer in
|
||||||
|
[Yy]*)
|
||||||
|
echo "source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" >> "${GHCUP_PROFILE_FILE}"
|
||||||
|
exit 0;;
|
||||||
|
[Nn]*)
|
||||||
|
exit 0;;
|
||||||
|
*)
|
||||||
|
echo "Please type YES or NO and press enter.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user