diff --git a/scripts/offlinepi/offlinepi-record b/scripts/offlinepi/offlinepi-record index 0b1760122dc3..8f21a8eddca7 100755 --- a/scripts/offlinepi/offlinepi-record +++ b/scripts/offlinepi/offlinepi-record @@ -14,21 +14,21 @@ if [ -z "$path" ]; then exit 1 fi -if [ ! -z "$*" ]; then +if [ -n "$*" ]; then echo "Unexpected extra arguments: $*" exit 1 fi # Remove the file before starting -rm $path 2> /dev/null +rm "$path" 2> /dev/null # N.B. Additional options must be added _before_ the filter string exec mitmdump \ - -w $path \ + -w "$path" \ --set stream_large_bodies=1000m \ "~d pypi.org|files.pythonhosted.org|mitm.it" # stream_large_bodies: must be set to a large value or large responses will not be recorded # resulting in an unexpected file endings during replays # ~d: only interactions with package index domains should be recorded -# we also allow `mitm.it` so healthchecks succeed when replaying \ No newline at end of file +# we also allow `mitm.it` so healthchecks succeed when replaying diff --git a/scripts/offlinepi/offlinepi-replay b/scripts/offlinepi/offlinepi-replay index 36712d5d9214..fb7aa7dd4752 100755 --- a/scripts/offlinepi/offlinepi-replay +++ b/scripts/offlinepi/offlinepi-replay @@ -16,12 +16,12 @@ if [ -z "$path" ]; then exit 1 fi -if [ ! -z "$*" ]; then +if [ -n "$*" ]; then echo "Unexpected extra arguments: $*" exit 1 fi -exec mitmdump --server-replay $path \ +exec mitmdump --server-replay "$path" \ --server-replay-extra 500 \ --set connection_strategy=lazy diff --git a/scripts/offlinepi/offlinepi-stop b/scripts/offlinepi/offlinepi-stop index e391742fba69..583903ab1eb2 100755 --- a/scripts/offlinepi/offlinepi-stop +++ b/scripts/offlinepi/offlinepi-stop @@ -14,11 +14,11 @@ if [ -z "$pid" ]; then exit 1 fi -if [ ! -z "$*" ]; then +if [ -n "$*" ]; then echo "Unexpected extra arguments: $*" exit 1 fi -kill $pid 2> /dev/null -wait $pid 2> /dev/null +kill "$pid" 2> /dev/null +wait "$pid" 2> /dev/null echo "Done!" diff --git a/scripts/offlinepi/offlinepi-wait b/scripts/offlinepi/offlinepi-wait index f54bab3e0537..5cfb87c91577 100755 --- a/scripts/offlinepi/offlinepi-wait +++ b/scripts/offlinepi/offlinepi-wait @@ -7,6 +7,7 @@ # offlinepi-wait-ready projectroot=$(realpath "$(dirname "$0")") +healthcheck="$projectroot/offlinepi-healthcheck" pid=$1 shift @@ -16,15 +17,15 @@ if [ -z "$pid" ]; then exit 1 fi -if [ ! -z "$*" ]; then +if [ -n "$*" ]; then echo "Unexpected extra arguments: $*" exit 1 fi # Wait until the server is ready -until $($projectroot/offlinepi-healthcheck); do - if ! kill -0 $pid 2> /dev/null; then +until $healthcheck; do + if ! kill -0 "$pid" 2> /dev/null; then exit 1 fi sleep 1