#!/bin/bash set -e signals=(1 2 3 4 5 6 8 10 12 13 14 15 16 20 21 22 23 24 25 26 64) SOCK_FILE=$(mktemp --dry-run --tmpdir io.podman.XXXXXX) VARLINK_LOG=$(mktemp --dry-run --tmpdir varlink.log.XXXXXX) export PODMAN_VARLINK_ADDRESS=unix:$SOCK_FILE cleanup() { set +e echo "Cleaning up" ./bin/podman-remote stop --timeout 0 foobar ./bin/podman-remote rm -f foobar kill -9 %1 rm -f $SOCK_FILE echo "Varlinkg log file: $VARLINK_LOG" } trap cleanup EXIT echo "Starting background varlink server" sudo rm -rf ${HOME}/.local/share/containers ${HOME}/.config/containers ./bin/podman varlink --timeout=0 $PODMAN_VARLINK_ADDRESS &> $VARLINK_LOG & sleep 5s echo "Starting background signal-recipient container" ./bin/podman-remote run -d --name=foobar fedora-minimal sh -c "for i in ${signals[*]}; do trap \"echo got: \$i\" \$i; done; echo READY; while ! test -e /stop; do sleep 0.05; done;echo DONE" for s in $(fmt --width=2 <<< "${signals[*]}" | sort -r); do echo "Sending signal $s" ./bin/podman-remote kill -s $s foobar &> /dev/null sleep 0.1s ./bin/podman-remote logs --tail 1 foobar done sleep 3s echo "Final, complete ourput from foobar container:" ./bin/podman-remote logs foobar