diff --git a/app/views/install_beta.scala.txt b/app/views/install_beta.scala.txt index a089a7c..550309a 100644 --- a/app/views/install_beta.scala.txt +++ b/app/views/install_beta.scala.txt @@ -27,7 +27,6 @@ sdkman_var_folder="${SDKMAN_DIR}/var" sdkman_candidates_folder="${SDKMAN_DIR}/candidates" sdkman_config_file="${sdkman_etc_folder}/config" sdkman_bash_profile="${HOME}/.bash_profile" -sdkman_profile="${HOME}/.profile" sdkman_bashrc="${HOME}/.bashrc" sdkman_zshrc="${ZDOTDIR:-${HOME}}/.zshrc" @@ -107,28 +106,24 @@ echo "$SDKMAN_NATIVE_VERSION" > "${SDKMAN_DIR}/var/version_native" @if(rcUpdate) { if [[ $darwin == true ]]; then - touch "$sdkman_bash_profile" echo "Attempt update of login bash profile on OSX..." - if [[ -z $(grep 'sdkman-init.sh' "$sdkman_bash_profile") ]]; then + if [[ -e "$sdkman_bash_profile" && -z $(grep 'sdkman-init.sh' "$sdkman_bash_profile") ]]; then echo -e "\n$sdkman_init_snippet" >> "$sdkman_bash_profile" echo "Added sdkman init snippet to $sdkman_bash_profile" fi else echo "Attempt update of interactive bash profile on regular UNIX..." - touch "${sdkman_bashrc}" - if [[ -z $(grep 'sdkman-init.sh' "$sdkman_bashrc") ]]; then + if [[ -e "${sdkman_bashrc}" && -z $(grep 'sdkman-init.sh' "$sdkman_bashrc") ]]; then echo -e "\n$sdkman_init_snippet" >> "$sdkman_bashrc" echo "Added sdkman init snippet to $sdkman_bashrc" fi fi echo "Attempt update of zsh profile..." -touch "$sdkman_zshrc" -if [[ -z $(grep 'sdkman-init.sh' "$sdkman_zshrc") ]]; then +if [[ -e "$sdkman_zshrc" && -z $(grep 'sdkman-init.sh' "$sdkman_zshrc") ]]; then echo -e "\n$sdkman_init_snippet" >> "$sdkman_zshrc" echo "Updated existing ${sdkman_zshrc}" fi - } -@includes.install_message(beta) \ No newline at end of file +@includes.install_message(beta) diff --git a/app/views/install_stable.scala.txt b/app/views/install_stable.scala.txt index aade15d..7251bfd 100644 --- a/app/views/install_stable.scala.txt +++ b/app/views/install_stable.scala.txt @@ -26,7 +26,6 @@ sdkman_archives_folder="${SDKMAN_DIR}/archives" sdkman_candidates_folder="${SDKMAN_DIR}/candidates" sdkman_config_file="${sdkman_etc_folder}/config" sdkman_bash_profile="${HOME}/.bash_profile" -sdkman_profile="${HOME}/.profile" sdkman_bashrc="${HOME}/.bashrc" sdkman_zshrc="${ZDOTDIR:-${HOME}}/.zshrc" @@ -112,28 +111,24 @@ echo "$SDKMAN_VERSION" > "${SDKMAN_DIR}/var/version" @if(rcUpdate) { if [[ $darwin == true ]]; then - touch "$sdkman_bash_profile" echo "Attempt update of login bash profile on OSX..." - if [[ -z $(grep 'sdkman-init.sh' "$sdkman_bash_profile") ]]; then + if [[ -e "$sdkman_bash_profile" && -z $(grep 'sdkman-init.sh' "$sdkman_bash_profile") ]]; then echo -e "\n$sdkman_init_snippet" >> "$sdkman_bash_profile" echo "Added sdkman init snippet to $sdkman_bash_profile" fi else echo "Attempt update of interactive bash profile on regular UNIX..." - touch "${sdkman_bashrc}" - if [[ -z $(grep 'sdkman-init.sh' "$sdkman_bashrc") ]]; then + if [[ -e "${sdkman_bashrc}" && -z $(grep 'sdkman-init.sh' "$sdkman_bashrc") ]]; then echo -e "\n$sdkman_init_snippet" >> "$sdkman_bashrc" echo "Added sdkman init snippet to $sdkman_bashrc" fi fi echo "Attempt update of zsh profile..." -touch "$sdkman_zshrc" -if [[ -z $(grep 'sdkman-init.sh' "$sdkman_zshrc") ]]; then +if [[ -e "$sdkman_zshrc" && -z $(grep 'sdkman-init.sh' "$sdkman_zshrc") ]]; then echo -e "\n$sdkman_init_snippet" >> "$sdkman_zshrc" echo "Updated existing ${sdkman_zshrc}" fi - } -@includes.install_message(beta) \ No newline at end of file +@includes.install_message(beta)