Skip to content

Commit

Permalink
shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Dec 12, 2023
1 parent c4cb290 commit 5565aef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions scripts/offlinepi/offlinepi-record
Original file line number Diff line number Diff line change
Expand Up @@ -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
# we also allow `mitm.it` so healthchecks succeed when replaying
4 changes: 2 additions & 2 deletions scripts/offlinepi/offlinepi-replay
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions scripts/offlinepi/offlinepi-stop
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
7 changes: 4 additions & 3 deletions scripts/offlinepi/offlinepi-wait
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# offlinepi-wait-ready <pid>

projectroot=$(realpath "$(dirname "$0")")
healthcheck="$projectroot/offlinepi-healthcheck"

pid=$1
shift
Expand All @@ -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
Expand Down

0 comments on commit 5565aef

Please sign in to comment.