From 954752e74b3ca3ef380be3bbb7ac57dada5a6572 Mon Sep 17 00:00:00 2001 From: Thomas Krag Date: Mon, 6 Aug 2018 18:16:54 +0200 Subject: [PATCH] Add conditional for brew gnu-sed on MacOS --- utilities/add_new_event.sh | 5 ++++- utilities/add_organizers.sh | 5 ++++- utilities/add_program.sh | 5 ++++- utilities/add_speakers.sh | 5 ++++- utilities/add_sponsors.sh | 5 ++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/utilities/add_new_event.sh b/utilities/add_new_event.sh index d8ef12139a..25bf2a53b2 100755 --- a/utilities/add_new_event.sh +++ b/utilities/add_new_event.sh @@ -6,10 +6,13 @@ cd `dirname ${0}` # Detect OS for correct 'sed' syntax OSNAME=`uname` +GNUSED=$(which sed) SEDCMD(){ if [[ $OSNAME == 'Linux' ]]; then sed -i "$@" - elif [[ $OSNAME == 'Darwin' ]]; then + elif [[ $OSNAME == 'Darwin' && $GNUSED == '/usr/local/bin/sed' ]]; then + sed -i "$@" + else sed -i '' "$@" fi } diff --git a/utilities/add_organizers.sh b/utilities/add_organizers.sh index 7980c3cd7a..e947a629c7 100755 --- a/utilities/add_organizers.sh +++ b/utilities/add_organizers.sh @@ -9,10 +9,13 @@ OUT=$(mktemp /tmp/output.XXXXXXXXXX) || { echo "Failed to create temp file"; exi # Detect OS for correct 'sed' syntax OSNAME=`uname` +GNUSED=$(which sed) SEDCMD(){ if [[ $OSNAME == 'Linux' ]]; then sed -i "$@" - elif [[ $OSNAME == 'Darwin' ]]; then + elif [[ $OSNAME == 'Darwin' && $GNUSED == '/usr/local/bin/sed' ]]; then + sed -i "$@" + else sed -i '' "$@" fi } diff --git a/utilities/add_program.sh b/utilities/add_program.sh index 6f3d9dfa90..28be3dc5f0 100755 --- a/utilities/add_program.sh +++ b/utilities/add_program.sh @@ -6,10 +6,13 @@ cd `dirname ${0}` # Detect OS for correct 'sed' syntax OSNAME=`uname` +GNUSED=$(which sed) SEDCMD(){ if [[ $OSNAME == 'Linux' ]]; then sed -i "$@" - elif [[ $OSNAME == 'Darwin' ]]; then + elif [[ $OSNAME == 'Darwin' && $GNUSED == '/usr/local/bin/sed' ]]; then + sed -i "$@" + else sed -i '' "$@" fi } diff --git a/utilities/add_speakers.sh b/utilities/add_speakers.sh index 0b60dad3bd..52fe4a180e 100755 --- a/utilities/add_speakers.sh +++ b/utilities/add_speakers.sh @@ -6,10 +6,13 @@ cd `dirname ${0}` # Detect OS for correct 'sed' syntax OSNAME=`uname` +GNUSED=$(which sed) SEDCMD(){ if [[ $OSNAME == 'Linux' ]]; then sed -i "$@" - elif [[ $OSNAME == 'Darwin' ]]; then + elif [[ $OSNAME == 'Darwin' && $GNUSED == '/usr/local/bin/sed' ]]; then + sed -i "$@" + else sed -i '' "$@" fi } diff --git a/utilities/add_sponsors.sh b/utilities/add_sponsors.sh index 13ff50c6a7..22bf862400 100755 --- a/utilities/add_sponsors.sh +++ b/utilities/add_sponsors.sh @@ -5,10 +5,13 @@ set -e cd `dirname ${0}` # Detect OS for correct 'sed' syntax OSNAME=`uname` +GNUSED=$(which sed) SEDCMD(){ if [[ $OSNAME == 'Linux' ]]; then sed -i "$@" - elif [[ $OSNAME == 'Darwin' ]]; then + elif [[ $OSNAME == 'Darwin' && $GNUSED == '/usr/local/bin/sed' ]]; then + sed -i "$@" + else sed -i '' "$@" fi }