summaryrefslogtreecommitdiff
path: root/tools/macos-firewall.sh
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2018-05-07 11:26:17 -0700
committerRich Trott <rtrott@gmail.com>2018-05-10 14:46:51 -0700
commitf145a53a78a0d9cb6a82cefa54646a43ef23cfa3 (patch)
tree7fe1bc27a5df0caabcca90cd0b535ae5d7e7b9a0 /tools/macos-firewall.sh
parent778f248914e1b498cd5d5e29006e346c62e8dcc6 (diff)
downloadandroid-node-v8-f145a53a78a0d9cb6a82cefa54646a43ef23cfa3.tar.gz
android-node-v8-f145a53a78a0d9cb6a82cefa54646a43ef23cfa3.tar.bz2
android-node-v8-f145a53a78a0d9cb6a82cefa54646a43ef23cfa3.zip
tools: use macOS as operating system name
As of 2016, the operating system is macOS. Remove use of "macosx". PR-URL: https://github.com/nodejs/node/pull/20579 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'tools/macos-firewall.sh')
-rwxr-xr-xtools/macos-firewall.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/macos-firewall.sh b/tools/macos-firewall.sh
new file mode 100755
index 0000000000..c1de916e3c
--- /dev/null
+++ b/tools/macos-firewall.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Script that adds rules to Mac OS X Socket Firewall to avoid
+# popups asking to accept incoming network connections when
+# running tests.
+SFW="/usr/libexec/ApplicationFirewall/socketfilterfw"
+TOOLSDIR="`dirname \"$0\"`"
+TOOLSDIR="`( cd \"$TOOLSDIR\" && pwd) `"
+ROOTDIR="`( cd \"$TOOLSDIR/..\" && pwd) `"
+OUTDIR="$TOOLSDIR/../out"
+# Using cd and pwd here so that the path used for socketfilterfw does not
+# contain a '..', which seems to cause the rules to be incorrectly added
+# and they are not removed when this script is re-run. Instead the new
+# rules are simply appended. By using pwd we can get the full path
+# without '..' and things work as expected.
+OUTDIR="`( cd \"$OUTDIR\" && pwd) `"
+NODE_RELEASE="$OUTDIR/Release/node"
+NODE_DEBUG="$OUTDIR/Debug/node"
+NODE_LINK="$ROOTDIR/node"
+CCTEST_RELEASE="$OUTDIR/Release/cctest"
+CCTEST_DEBUG="$OUTDIR/Debug/cctest"
+
+if [ -f $SFW ];
+then
+ # Duplicating these commands on purpose as the symbolic link node might be
+ # linked to either out/Debug/node or out/Release/node depending on the
+ # BUILDTYPE.
+ $SFW --remove "$NODE_DEBUG"
+ $SFW --remove "$NODE_DEBUG"
+ $SFW --remove "$NODE_RELEASE"
+ $SFW --remove "$NODE_RELEASE"
+ $SFW --remove "$NODE_LINK"
+ $SFW --remove "$CCTEST_DEBUG"
+ $SFW --remove "$CCTEST_RELEASE"
+
+ $SFW --add "$NODE_DEBUG"
+ $SFW --add "$NODE_RELEASE"
+ $SFW --add "$NODE_LINK"
+ $SFW --add "$CCTEST_DEBUG"
+ $SFW --add "$CCTEST_RELEASE"
+
+ $SFW --unblock "$NODE_DEBUG"
+ $SFW --unblock "$NODE_RELEASE"
+ $SFW --unblock "$NODE_LINK"
+ $SFW --unblock "$CCTEST_DEBUG"
+ $SFW --unblock "$CCTEST_RELEASE"
+else
+ echo "SocketFirewall not found in location: $SFW"
+fi