Skip to content

Commit ffe91be

Browse files
committed
Merge pull request EFForg#1714 from ErinCall/bsd-utils-compatibility
Fix shell scripts for BSD-ish systems
2 parents c1b2ea7 + d9a235f commit ffe91be

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

run-chromium.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# Build the extension and run a chromium extension with it installed.
44
#
55
set -o errexit -o xtrace
6+
67
cd $(dirname $0)
8+
79
source makecrx.sh
10+
source utils/mktemp.sh
11+
812
PROFILE_DIRECTORY="$(mktemp -d)"
913
trap 'rm -r "$PROFILE_DIRECTORY"' EXIT
1014
chromium-browser \

test-ruleset-coverage.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# Test that all rulesets modified after a certain date have sufficient test
44
# coverage, according to the ruleset checker.
55
#
6+
67
cd $(dirname $0)
7-
TMP=`mktemp`
8+
9+
source utils/mktemp.sh
10+
11+
TMP="$(mktemp)"
812
trap 'rm "$TMP"' EXIT
913
if ! [ -d https-everywhere-checker ] ; then
1014
echo "Submodule https-everywhere-checker is missing. Run"

test.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#!/bin/bash -ex
22
# Run tests for HTTPS Everywhere
33

4-
# We have to change to the right directory because this is sometimes invoked
5-
# through a symlink in .git/hooks/pre-push.
6-
cd $(dirname $(readlink -f $0))
4+
# Get into the project-root. This script may be executed as `test.sh`
5+
# or as .git/hooks/pre-push, so we need to find the directory containing
6+
# test.sh before we can proceed. If $0 is not a symlink, `readlink` will
7+
# print nothing; if it is a symlink it will print the link target.
8+
cd $(dirname $0)/$(dirname $(readlink $0))
9+
10+
source utils/mktemp.sh
711

812
# dummy Jetpack addon that contains tests
913
TEST_ADDON_PATH=./https-everywhere-tests/
@@ -65,4 +69,5 @@ bash test-ruleset-coverage.sh
6569
echo "To reproduce this build (https://wiki.debian.org/ReproducibleBuilds)," \
6670
"please use this version of sqlite3:"
6771
sqlite3 -version
68-
echo -e "Git commit `git rev-parse HEAD`\nsha256sum `sha256sum $XPI_NAME`"
72+
shasum=$(openssl sha -sha256 "$XPI_NAME")
73+
echo -e "Git commit `git rev-parse HEAD`\n$shasum"

utils/mktemp.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
#
3+
# BSD and GNU mktemp have slightly different invocation patterns.
4+
# BSD's needs a -t option specifying a "template." 'everywhere' will
5+
# end up in the temp-folder name, so in the event it doesn't get cleaned
6+
# up, there's some indication of where it originated.
7+
8+
MKTEMP=`which mktemp`
9+
function mktemp() {
10+
$MKTEMP $@ 2>/dev/null || $MKTEMP -t everywhere $@
11+
}

0 commit comments

Comments
 (0)