foot/pgo/full-headless-sway.sh
Daniel Eklöf 99c4e51e19
pgo: add set -x to all PGO scripts
Without this, debugging error reports from users is going to be _very_
difficult...
2021-09-12 10:39:44 +02:00

24 lines
637 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
set -eux
srcdir=$(realpath "${1}")
blddir=$(realpath "${2}")
runtime_dir=$(mktemp -d)
sway_conf=$(mktemp)
cleanup() {
rm -f "${sway_conf}"
rm -rf "${runtime_dir}"
}
trap cleanup EXIT INT HUP TERM
# Generate a custom config that executes our generate-pgo-data script
> "${sway_conf}" echo "exec '${srcdir}'/pgo/full-headless-sway-inner.sh '${srcdir}' '${blddir}'"
# Run Sway. full-headless-sway-inner.sh ends with a swaymsg exit
XDG_RUNTIME_DIR="${runtime_dir}" WLR_BACKENDS=headless sway -c "${sway_conf}"
# Sways exit code doesnt reflect our scripts exit code
[ -f "${blddir}"/pgo-ok ] || exit 1