Skip to content

Commit a033910

Browse files
aduh95targos
authored andcommitted
tools: remove bashisms from macOS release scripts
PR-URL: #36121 Reviewed-By: Rich Trott <[email protected]>
1 parent 9434bb3 commit a033910

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ $(PKG): release-only
978978
--release-urlbase=$(RELEASE_URLBASE) \
979979
$(CONFIG_FLAGS) $(BUILD_RELEASE_FLAGS)
980980
$(MAKE) install V=$(V) DESTDIR=$(MACOSOUTDIR)/dist/node
981-
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" bash \
981+
SIGN="$(CODESIGN_CERT)" PKGDIR="$(MACOSOUTDIR)/dist/node/usr/local" sh \
982982
tools/osx-codesign.sh
983983
mkdir -p $(MACOSOUTDIR)/dist/npm/usr/local/lib/node_modules
984984
mkdir -p $(MACOSOUTDIR)/pkgs
@@ -1000,8 +1000,8 @@ $(PKG): release-only
10001000
productbuild --distribution $(MACOSOUTDIR)/installer/productbuild/distribution.xml \
10011001
--resources $(MACOSOUTDIR)/installer/productbuild/Resources \
10021002
--package-path $(MACOSOUTDIR)/pkgs ./$(PKG)
1003-
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" bash tools/osx-productsign.sh
1004-
bash tools/osx-notarize.sh $(FULLVERSION)
1003+
SIGN="$(PRODUCTSIGN_CERT)" PKG="$(PKG)" sh tools/osx-productsign.sh
1004+
sh tools/osx-notarize.sh $(FULLVERSION)
10051005

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

tools/osx-codesign.sh

Lines changed: 5 additions & 4 deletions
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

Lines changed: 6 additions & 8 deletions
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

Lines changed: 6 additions & 4 deletions
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)