From 2a80e9368dff47cd05fee5bf3cf7d88f68c2f8e9 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 12 May 2024 12:21:22 -0600 Subject: [PATCH] Update entrypoint.sh --- entrypoint.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d836cba..f153c84 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,9 +22,10 @@ echo "Validated postgresql version: $INPUT_POSTGRESQL_VERSION" echo "Installing postgresql..." -echo "OS: $(uname -s)" +OS=$(uname -s) +echo "OS: $OS" -if [[ "$(uname -s)" == "Linux" ]]; then +if [[ "$OS" == "Linux" ]]; then # Create the file repository configuration: sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' @@ -36,9 +37,9 @@ if [[ "$(uname -s)" == "Linux" ]]; then # Install PostgreSQL sudo apt-get install -y "postgresql-$INPUT_POSTGRESQL_VERSION" -elif [[ "$(uname -s)" == "NT"* ]] || [[ "$(uname -s)" == "MINGW"* ]] || [[ "$(uname -s)" == *"MSYS"* ]]; then +elif [[ "$OS" == "NT"* ]] || [[ "$OS" == "MINGW"* ]] || [[ "$OS" == *"MSYS"* ]]; then choco install "postgresql$INPUT_POSTGRESQL_VERSION" -y --no-progress --use-download-cache -elif [[ "$(uname -s)" == "Darwin" ]]; then +elif [[ "$OS" == "Darwin" ]]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install "postgresql@$INPUT_POSTGRESQL_VERSION" else echo "Unsupported OS" @@ -49,10 +50,10 @@ echo "Installed postgresql" echo "Updating PATH..." -if [[ "$(uname -s)" == "NT"* ]] || [[ "$(uname -s)" == "MINGW"* ]] || [[ "$(uname -s)" == *"MSYS"* ]]; then +if [[ "$OS" == "NT"* ]] || [[ "$OS" == "MINGW"* ]] || [[ "$OS" == *"MSYS"* ]]; then # shellcheck disable=SC2028 echo "C:\\Program Files\\PostgreSQL\\$INPUT_POSTGRESQL_VERSION\\bin" >> "$GITHUB_PATH" -elif [[ "$(uname -s)" == "Darwin" ]]; then +elif [[ "$OS" == "Darwin" ]]; then echo "$(brew --prefix postgresql@"${INPUT_POSTGRESQL_VERSION}")/bin" >> "$GITHUB_PATH" else echo "/usr/lib/postgresql/$INPUT_POSTGRESQL_VERSION/bin" >> "$GITHUB_PATH"