From a5afee4da8abc6e081a8a69f23c1248d1af5007a Mon Sep 17 00:00:00 2001 From: Chris Reynolds Date: Fri, 22 Sep 2023 15:29:15 -0600 Subject: [PATCH] sed conditional needs to go inside the ostype condition --- private/scripts/helpers.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/private/scripts/helpers.sh b/private/scripts/helpers.sh index 6e67d842..61c23da9 100755 --- a/private/scripts/helpers.sh +++ b/private/scripts/helpers.sh @@ -377,14 +377,15 @@ function update_composer() { if [[ "$OSTYPE" == "darwin"* ]]; then # Mac OS - sed -i '' "s,%sagedir%,$sagedir," composer.new.json + if ! sed -i '' "s,%sagedir%,$sagedir," composer.new.json; then + echo "${red}Failed to add post-install hook to composer.json. Exiting here.${normal}" + exit 1; else # Linux - sed -i "s,%sagedir%,$sagedir," composer.new.json - fi - if ! sed -i '' "s,%sagedir%,$sagedir," composer.new.json; then - echo "${red}Failed to add post-install hook to composer.json. Exiting here.${normal}" - exit 1; + if ! sed -i "s,%sagedir%,$sagedir," composer.new.json; then + echo "${red}Failed to add post-install hook to composer.json. Exiting here.${normal}" + exit 1; + fi fi rm composer.json