#!/bin/sh

set -e

PXE_SERVER_IP=$(cat /etc/oci/pxe-server-ip)

curl http://${PXE_SERVER_IP}/oci/install-status.php?status=installing
if ! build-openstack-debian-image $@ --pre-reboot-hook /usr/bin/oci-install-pre-reboot-hook ; then
        # TODO: Report this as failed OS install
        curl http://${PXE_SERVER_IP}/oci/install-status.php?status=live
fi
