mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Stop requiring bash in test-network.sh. Make it POSIX compliant
This commit is contained in:
parent
965f0d8912
commit
eaf071d7da
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
# This script calls the equivalent script in chutney/tools
|
# This script calls the equivalent script in chutney/tools
|
||||||
|
|
||||||
@ -18,32 +18,18 @@ ECHO="${ECHO:-echo}"
|
|||||||
# Output is prefixed with the name of the script
|
# Output is prefixed with the name of the script
|
||||||
myname=$(basename "$0")
|
myname=$(basename "$0")
|
||||||
|
|
||||||
# Save the arguments before we destroy them
|
|
||||||
# This might not preserve arguments with spaces in them
|
|
||||||
ORIGINAL_ARGS=( "$@" )
|
|
||||||
|
|
||||||
# We need to find CHUTNEY_PATH, so that we can call the version of this script
|
# We need to find CHUTNEY_PATH, so that we can call the version of this script
|
||||||
# in chutney/tools with the same arguments. We also need to respect --quiet.
|
# in chutney/tools with the same arguments. We also need to respect --quiet.
|
||||||
until [ -z "$1" ]
|
CHUTNEY_PATH=$(echo "$@" | awk -F '--chutney-path ' '{sub(" .*","",$2); print $2}')
|
||||||
do
|
TOR_DIR=$(echo "$@" | awk -F '--tor-dir ' '{sub(" .*","",$2); print $2}')
|
||||||
case "$1" in
|
|
||||||
--chutney-path)
|
if echo "$@" | grep -e "--quiet" > /dev/null; then
|
||||||
CHUTNEY_PATH="$2"
|
ECHO=true
|
||||||
shift
|
fi
|
||||||
;;
|
|
||||||
--tor-path)
|
echo "CHUTNEY_PATH = $CHUTNEY_PATH"
|
||||||
TOR_DIR="$2"
|
echo "TOR_DIR = $TOR_DIR"
|
||||||
shift
|
echo "ECHO = $ECHO"
|
||||||
;;
|
|
||||||
--quiet)
|
|
||||||
ECHO=true
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# maybe chutney's test-network.sh can handle it
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
# optional: $TOR_DIR is the tor build directory
|
# optional: $TOR_DIR is the tor build directory
|
||||||
# it's used to find the location of tor binaries
|
# it's used to find the location of tor binaries
|
||||||
@ -99,7 +85,7 @@ if [ -d "$CHUTNEY_PATH" ] && [ -x "$TEST_NETWORK" ]; then
|
|||||||
# this may fail if some arguments have spaces in them
|
# this may fail if some arguments have spaces in them
|
||||||
# if so, set CHUTNEY_PATH before calling test-network.sh, and spaces
|
# if so, set CHUTNEY_PATH before calling test-network.sh, and spaces
|
||||||
# will be handled correctly
|
# will be handled correctly
|
||||||
exec "$TEST_NETWORK" "${ORIGINAL_ARGS[@]}" # $ORIGINAL_ARGS
|
exec "$TEST_NETWORK" "$@"
|
||||||
else
|
else
|
||||||
$ECHO "$myname: Could not find tools/test-network.sh in CHUTNEY_PATH."
|
$ECHO "$myname: Could not find tools/test-network.sh in CHUTNEY_PATH."
|
||||||
$ECHO "$myname: Please update your chutney using 'git pull'."
|
$ECHO "$myname: Please update your chutney using 'git pull'."
|
||||||
|
Loading…
Reference in New Issue
Block a user