#!/usr/bin/env bash

set -e

if ! command -v gameap-daemon &> /dev/null
then
    sleep 5
    curl http://${GAMEAP_HOST:-gameap}/gdaemon/setup/test_auto_setup_token | bash --
    sleep 5

    gameapctl daemon stop
fi

gameap-daemon
