{% load grubcfg %}

{% include "./grubcfg_debug" %}
{% include "./grubcfg_user" %}

{% if device.run_request %}

{% render_runreq_grubcfg device %}
{% if 'noboot' not in flags %}
boot
{% endif %}

{% elif device.owner is not None %}

{% include "./grubcfg_autoreload" %}
echo "This device ({{ device.mac_address }}) has booted from the provisioning server at {{ service_url }}."
echo "The device is owned by {{ device.owner }}."
echo "Please visit the management portal at the above URL to provision this device."
echo ""
echo -n "Automatic config reload in: "

{% else %}

{% include "./grubcfg_autoreload" %}
echo "This device has booted from the provisioning server at {{ service_url }}."
echo "Please visit the management panel at the above URL to claim this device."
echo "Device MAC address: {{ device.mac_address }}."
echo ""
echo -n "Automatic config reload in: "

{% endif %}
