From d299db721eb853568bb598f1ddb89bebe098379d Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Tue, 23 Jul 2019 08:35:46 -0700 Subject: [PATCH] Check that $SED is executable (#188) refs #187 --- bin/promote-nightly-to-release | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/promote-nightly-to-release b/bin/promote-nightly-to-release index 96adbc11..cf310199 100755 --- a/bin/promote-nightly-to-release +++ b/bin/promote-nightly-to-release @@ -18,9 +18,20 @@ if ! echo "$VERSION" | grep -q -e '^[0-9]\+\.[0-9]\+$'; then echo "Only specify MAJOR.MINOR version, not MAJOR.MINOR.RELEASE" exit 1 fi + MAJOR=$(echo "$VERSION" | cut -f1 -d.) MINOR=$(echo "$VERSION" | cut -f2 -d.) +SED=$(if [ "$(uname -s)" == "Darwin" ]; then echo gsed; else echo sed; fi) + +if ! which $SED >/dev/null; then + echo "'$SED' is required." + if [ "$SED" == "gsed" ]; then + echo "Try: brew install gnu-sed" + fi + exit 1 +fi + PKGDIR="$(pwd)" if [ ! -e "$PKGDIR/bin/$(basename $0)" ]; then echo "This script must be ran from the root of the packaging repository." @@ -66,7 +77,6 @@ git clone git@github.com:hhvm/hhvm-docker.git cd hhvm-docker statusline "Removing 'latest' from previous release branch tags..." git checkout "HHVM-${MAJOR}.$(($MINOR - 1))" - SED=$(if [ "$(uname -s)" == "Darwin" ]; then echo gsed; else echo sed; fi) $SED -i '/^latest$/d' EXTRA_TAGS git commit EXTRA_TAGS -m "Removing 'latest' tag" git push