#!/bin/bash

function rebootOptions()
{
    if [ "$1" = "--fast" ]
    then
        echo Rebooting with kexec-tools for fastboot.
        echo "options sx_core fast_boot=1" > /etc/modprobe.d/sx.modprobe.conf
        /usr/lib/cumulus/kboot
    elif [ "$1" = "--help-fastboot" ]
    then
        echo "Use --fast option for fastboot with kexec"
    else
        echo "options sx_core fast_boot=0" > /etc/modprobe.d/sx.modprobe.conf
        /usr/sbin/reboot.real "$@"
    fi
}

# script #
rebootOptions $@
