diff --git a/.github/github_workflows.ex b/.github/github_workflows.ex index 65bddb3e..c0b46735 100644 --- a/.github/github_workflows.ex +++ b/.github/github_workflows.ex @@ -392,12 +392,6 @@ defmodule GithubWorkflows do shell_install_command = Keyword.fetch!(opts, :shell_install_command) expect_install_command = Keyword.fetch!(opts, :expect_install_command) - config_file = - case shell do - "bash" -> "~/.bash_profile" - "zsh" -> "~/.zshrc" - end - [ name: "Test #{os} script with #{shell} shell", "runs-on": runs_on, diff --git a/priv/static/Linux.sh b/priv/static/Linux.sh index cef308d4..5fb30433 100755 --- a/priv/static/Linux.sh +++ b/priv/static/Linux.sh @@ -31,14 +31,14 @@ postgres_version=15.1 case "${SHELL:-}" in */bash) current_shell="bash" - config_file="$HOME/.bash_profile" + config_file="$HOME/.bashrc" ;; */zsh) current_shell="zsh" config_file="$HOME/.zshrc" ;; *) - echo "Unsupported shell: $current_shell" + echo "Unsupported shell: $SHELL" exit 1 ;; esac @@ -82,11 +82,11 @@ function install() { curl https://mise.run | sh # Add activation command to the user's shell config file - printf "\n# Activate mise\n" >>"$config_file" - printf 'eval "$(~/.local/bin/mise activate %s)"\n' "$current_shell" >>"$config_file" + printf "\n# Activate mise\n" >> "$config_file" + printf 'eval "$(~/.local/bin/mise activate %s)"\n' "$current_shell" >> "$config_file" # Activate mise in the current shell session - eval "$(~/.local/bin/mise activate "$current_shell")" + eval "$(~/.local/bin/mise activate $current_shell)" ;; "Phoenix") mise exec -- mix local.hex --force @@ -240,3 +240,5 @@ while ! is_yn "$answer"; do ;; esac done + +echo "Setup complete. Please restart your terminal or run 'source $config_file' to apply changes." diff --git a/priv/static/macOS.sh b/priv/static/macOS.sh index feff4ab7..cccf3a5d 100755 --- a/priv/static/macOS.sh +++ b/priv/static/macOS.sh @@ -28,17 +28,17 @@ erlang_version=27.0.1 phoenix_version=1.7.14 postgres_version=15.1 -current_shell=$(basename "$SHELL") - -case "$current_shell" in - "bash" | "rbash") - config_file="$HOME/.bash_profile" +case "${SHELL:-}" in +*/bash) + current_shell="bash" + config_file="$HOME/.bashrc" ;; - "zsh") +*/zsh) + current_shell="zsh" config_file="$HOME/.zshrc" ;; - *) - echo "Unsupported shell: $current_shell" +*) + echo "Unsupported shell: $SHELL" exit 1 ;; esac