#!/bin/bash
#
# ======================================================
# VI editor settings
# set shiftwidth=4
# set tabstop=4
# ======================================================
# Title: boot normally after next reboot 
# Author: Mike Gore
# Date: 25 Oct 2016
# Depends: 
#   package: openmpi
#   scripts: ipmifunctions, common_host,common_vars,common_functions and NODES found in /usr/local/bin
#
# Example: ./ipmibios host-ilom
#           - Where host-ilom is the node ILOM/BMC interface
#           - needs and AMDIN user and password to function
# Result: The node will boot into BIOS on next restart
#
# Notes:
#        The script will prompt for ADMIN user and password unless the following environment variables are set:
# ADMIN - userid of ADMIN user
# ADMINPASS - Password of "ADMIN" user
# ======================================================
# BASH functions
. common_functions
# IPMI functions
. ipmifunctions

export ADMIN ADMINPASS OLDADMINPASS CSCFADM CSCFADMPASS OTHERUSER OTHERPASS
# ======================================================
LOM="$1"
if ! lom_check "$LOM"
then
        fatal "LOM $LOM is not responding"
fi

# Set ADMIN user and password
setadmin

echo Boot normally after next restart
ipmitool $LOMHOST -U $ADMIN -P $ADMINPASS chassis bootdev none