#!/usr/bin/env bash
if uname -a | grep -i linux; then
  echo "Sorry, this wont go well if you are on linux due to hub needing systemd and systemd needing privileged mode. When the container runs it will likely log you out of your GUI session. Very bad. FIXME. :)"
  exit 42
fi
set -e
set -x
# get a package based on NTECH_ROOT stuff :)
if [ ! -f ../../packages/cfengine-nova-hub*deb ]; then
  ../../buildscripts/ci/clean-build-package.sh
  ../../buildscripts/ci/docker-build-package.sh
fi
if [ ! -f hub/cfengine-nova-hub.deb ]; then
  cp ../../packages/cfengine-nova-hub*deb hub/cfengine-nova-hub.deb # where hub/Dockerfile expects it
fi
docker-compose build --progress=plain | tee build.log 2>&1
docker-compose up -d
