tools: remove bashisms from macOS release scripts

PR-URL: https://github.com/nodejs/node/pull/36121
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Antoine du Hamel 2020-11-14 18:30:45 +01:00 committed by Node.js GitHub Bot
parent 1729ba7578
commit 897307554a
4 changed files with 21 additions and 20 deletions

View file

@ -979,7 +979,7 @@ $(PKG): release-only
--release-urlbase=$(RELEASE_URLBASE) \ --release-urlbase=$(RELEASE_URLBASE) \
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS) $(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
$(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node $(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" bash \ SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
tools/osx-codesign.sh tools/osx-codesign.sh
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
mkdir -p $(MACOSOUTDIR)/pkgs mkdir -p $(MACOSOUTDIR)/pkgs
@ -1001,8 +1001,8 @@ $(PKG): release-only
productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \ productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \
--resources $(MACOSOUTDIR)/installer/productbuild/Resources \ --resources $(MACOSOUTDIR)/installer/productbuild/Resources \
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG) --package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
bash tools/osx-notarize.sh $(FULLVERSION) sh tools/osx-notarize.sh $(FULLVERSION)
.PHONY: pkg .PHONY: pkg
# Builds the macOS installer for releases. # Builds the macOS installer for releases.
@ -1120,7 +1120,7 @@ $(BINARYTAR): release-only
cp LICENSE $(BINARYNAME) cp LICENSE $(BINARYNAME)
cp CHANGELOG.md $(BINARYNAME) cp CHANGELOG.md $(BINARYNAME)
ifeq ($(OSTYPE),darwin) ifeq ($(OSTYPE),darwin)
SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" bash tools/osx-codesign.sh SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" sh tools/osx-codesign.sh
endif endif
tar -cf $(BINARYNAME).tar $(BINARYNAME) tar -cf $(BINARYNAME).tar $(BINARYNAME)
$(RM) -r $(BINARYNAME) $(RM) -r $(BINARYNAME)

View file

@ -1,17 +1,18 @@
#!/bin/bash #!/bin/sh
set -x set -x
set -e set -e
if [ "X$SIGN" == "X" ]; then # shellcheck disable=SC2154
echo "No SIGN environment var. Skipping codesign." >&2 [ -z "$SIGN" ] && \
echo "No SIGN environment var. Skipping codesign." >&2 && \
exit 0 exit 0
fi
# All macOS executable binaries in the bundle must be codesigned with the # All macOS executable binaries in the bundle must be codesigned with the
# hardened runtime enabled. # hardened runtime enabled.
# See https://github.com/nodejs/node/pull/31459 # See https://github.com/nodejs/node/pull/31459
# shellcheck disable=SC2154
codesign \ codesign \
--sign "$SIGN" \ --sign "$SIGN" \
--entitlements tools/osx-entitlements.plist \ --entitlements tools/osx-entitlements.plist \

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# Uses gon, from https://github.com/mitchellh/gon, to notarize a generated node-<version>.pkg file # Uses gon, from https://github.com/mitchellh/gon, to notarize a generated node-<version>.pkg file
# with Apple for installation on macOS Catalina and later as validated by Gatekeeper. # with Apple for installation on macOS Catalina and later as validated by Gatekeeper.
@ -8,18 +8,16 @@ set -e
gon_version="0.2.2" gon_version="0.2.2"
gon_exe="${HOME}/.gon/gon_${gon_version}" gon_exe="${HOME}/.gon/gon_${gon_version}"
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
pkgid="$1" pkgid="$1"
if [ "X${pkgid}" == "X" ]; then [ -z "$pkgid" ] && \
echo "Usage: $0 <pkgid>" echo "Usage: $0 <pkgid>" \
exit 1 exit 1
fi
if [ "X$NOTARIZATION_ID" == "X" ]; then # shellcheck disable=SC2154
echo "No NOTARIZATION_ID environment var. Skipping notarization." [ -z "$NOTARIZATION_ID" ] && \
echo "No NOTARIZATION_ID environment var. Skipping notarization." \
exit 0 exit 0
fi
set -x set -x

View file

@ -1,12 +1,14 @@
#!/bin/bash #!/bin/sh
set -x set -x
set -e set -e
if [ "X$SIGN" == "X" ]; then # shellcheck disable=SC2154
echo "No SIGN environment var. Skipping codesign." >&2 [ -z "$SIGN" ] && \
echo "No SIGN environment var. Skipping codesign." >&2 && \
exit 0 exit 0
fi
# shellcheck disable=SC2154
productsign --sign "$SIGN" "$PKG" "$PKG"-SIGNED productsign --sign "$SIGN" "$PKG" "$PKG"-SIGNED
# shellcheck disable=SC2154
mv "$PKG"-SIGNED "$PKG" mv "$PKG"-SIGNED "$PKG"