Skip to content

Commit 754b7a7

Browse files
aduh95danielleadams
authored andcommitted
tools: remove bashisms from macOS release scripts
PR-URL: #36121 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 2868ffb commit 754b7a7

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ $(PKG): release-only
979979
--release-urlbase=$(RELEASE_URLBASE) \
980980
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
981981
$(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node
982-
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" bash \
982+
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
983983
tools/osx-codesign.sh
984984
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
985985
mkdir -p $(MACOSOUTDIR)/pkgs
@@ -1001,8 +1001,8 @@ $(PKG): release-only
10011001
productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \
10021002
--resources $(MACOSOUTDIR)/installer/productbuild/Resources \
10031003
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
1004-
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh
1005-
bash tools/osx-notarize.sh $(FULLVERSION)
1004+
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
1005+
sh tools/osx-notarize.sh $(FULLVERSION)
10061006

10071007
.PHONY: pkg
10081008
# Builds the macOS installer for releases.
@@ -1120,7 +1120,7 @@ $(BINARYTAR): release-only
11201120
cp LICENSE $(BINARYNAME)
11211121
cp CHANGELOG.md $(BINARYNAME)
11221122
ifeq ($(OSTYPE),darwin)
1123-
SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" bash tools/osx-codesign.sh
1123+
SIGN="$(CODESIGN_CERT)" PKGDIR="$(BINARYNAME)" sh tools/osx-codesign.sh
11241124
endif
11251125
tar -cf $(BINARYNAME).tar $(BINARYNAME)
11261126
$(RM) -r $(BINARYNAME)

tools/osx-codesign.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
set -x
44
set -e
55

6-
if [ "X$SIGN" == "X" ]; then
7-
echo "No SIGN environment var. Skipping codesign." >&2
6+
# shellcheck disable=SC2154
7+
[ -z "$SIGN" ] && \
8+
echo "No SIGN environment var. Skipping codesign." >&2 && \
89
exit 0
9-
fi
1010

1111
# All macOS executable binaries in the bundle must be codesigned with the
1212
# hardened runtime enabled.
1313
# See https://github.com/nodejs/node/pull/31459
1414

15+
# shellcheck disable=SC2154
1516
codesign \
1617
--sign "$SIGN" \
1718
--entitlements tools/osx-entitlements.plist \

tools/osx-notarize.sh

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Uses gon, from https://github.com/mitchellh/gon, to notarize a generated node-<version>.pkg file
44
# with Apple for installation on macOS Catalina and later as validated by Gatekeeper.
@@ -8,18 +8,16 @@ set -e
88
gon_version="0.2.2"
99
gon_exe="${HOME}/.gon/gon_${gon_version}"
1010

11-
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1211
pkgid="$1"
1312

14-
if [ "X${pkgid}" == "X" ]; then
15-
echo "Usage: $0 <pkgid>"
13+
[ -z "$pkgid" ] && \
14+
echo "Usage: $0 <pkgid>" \
1615
exit 1
17-
fi
1816

19-
if [ "X$NOTARIZATION_ID" == "X" ]; then
20-
echo "No NOTARIZATION_ID environment var. Skipping notarization."
17+
# shellcheck disable=SC2154
18+
[ -z "$NOTARIZATION_ID" ] && \
19+
echo "No NOTARIZATION_ID environment var. Skipping notarization." \
2120
exit 0
22-
fi
2321

2422
set -x
2523

tools/osx-productsign.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
set -x
44
set -e
55

6-
if [ "X$SIGN" == "X" ]; then
7-
echo "No SIGN environment var. Skipping codesign." >&2
6+
# shellcheck disable=SC2154
7+
[ -z "$SIGN" ] && \
8+
echo "No SIGN environment var. Skipping codesign." >&2 && \
89
exit 0
9-
fi
1010

11+
# shellcheck disable=SC2154
1112
productsign --sign "$SIGN" "$PKG" "$PKG"-SIGNED
13+
# shellcheck disable=SC2154
1214
mv "$PKG"-SIGNED "$PKG"

0 commit comments

Comments
 (0)