new -W option for unified setup

This commit is contained in:
Christian Grothoff 2023-06-21 23:13:57 +02:00
parent c512c8b101
commit ef6496aba5
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -29,19 +29,21 @@ set -eu
# Exit, with status code "skip" (no 'real' failure) # Exit, with status code "skip" (no 'real' failure)
function exit_skip() { function exit_skip() {
echo " SKIP: " "$@" echo " SKIP: " "$@" >&2
exit 77 exit 77
} }
# Exit, with error message (hard failure) # Exit, with error message (hard failure)
function exit_fail() { function exit_fail() {
echo " FAIL: " "$@" echo " FAIL: " "$@" >&2
exit 1 exit 1
} }
# Cleanup to run whenever we exit # Cleanup to run whenever we exit
function cleanup() function cleanup()
{ {
echo "Taler unified setup terminating!" >&2
for n in $(jobs -p) for n in $(jobs -p)
do do
kill $n 2> /dev/null || true kill $n 2> /dev/null || true
@ -53,6 +55,7 @@ function cleanup()
# Install cleanup handler (except for kill -9) # Install cleanup handler (except for kill -9)
trap cleanup EXIT trap cleanup EXIT
WAIT_FOR_SIGNAL=0
START_AUDITOR=0 START_AUDITOR=0
START_BACKUP=0 START_BACKUP=0
START_EXCHANGE=0 START_EXCHANGE=0
@ -71,7 +74,7 @@ LOGLEVEL="DEBUG"
DEFAULT_SLEEP="0.2" DEFAULT_SLEEP="0.2"
# Parse command-line options # Parse command-line options
while getopts ':abc:d:efghl:mnr:stu:vw' OPTION; do while getopts ':abc:d:efghl:mnr:stu:vwW' OPTION; do
case "$OPTION" in case "$OPTION" in
a) a)
START_AUDITOR="1" START_AUDITOR="1"
@ -142,6 +145,9 @@ while getopts ':abc:d:efghl:mnr:stu:vw' OPTION; do
w) w)
START_WIREWATCH="1" START_WIREWATCH="1"
;; ;;
W)
WAIT_FOR_SIGNAL="1"
;;
?) ?)
exit_fail "Unrecognized command line option" exit_fail "Unrecognized command line option"
;; ;;
@ -218,6 +224,8 @@ register_sandbox_account() {
} }
if [[ "1" = "$START_NEXUS" || "1" = "$START_FAKEBANK" ]]
then
BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT") BANK_PORT=$(taler-config -c "$CONF" -s "BANK" -o "HTTP_PORT")
if [ "1" = "$START_NEXUS" ] if [ "1" = "$START_NEXUS" ]
then then
@ -227,6 +235,7 @@ else
NEXUS_PORT="0" NEXUS_PORT="0"
SANDBOX_PORT="1$BANK_PORT" SANDBOX_PORT="1$BANK_PORT"
fi fi
fi
if [ "1" = "$START_SANDBOX" ] if [ "1" = "$START_SANDBOX" ]
then then
@ -694,7 +703,17 @@ fi
# Signal caller that we are ready. # Signal caller that we are ready.
echo "<<READY>>" echo "<<READY>>"
if [ "1" = "$WAIT_FOR_SIGNAL" ]
then
while true
do
sleep 0.1
done
else
# Wait until caller stops us. # Wait until caller stops us.
read read
fi
echo "Taler unified setup terminating!" >&2
exit 0 exit 0