#!/bin/sh
set -eu

# Setup the environment
TEMP=$(mktemp -d)
mv dist $TEMP/

cleanup() {
    mv $TEMP/dist dist
}

trap cleanup EXIT HUP INT TERM

# Run the tests
if [ -e /run/systemd/system ]; then
    systemctl start lxd-bridge || true
fi

export LXD_OFFLINE=1
(cd test/ && ./main.sh)
