#!/bin/bash
# #/**
#        setBootMode
#@brief   Script to configure the  PXE mode to client
#@param 1 template 
#@date   2012-02-2-9
#*/ ##

REPOIP="$(ogGetRepoIp)"
PORT=2011
TEMPLATE="/opt/oglive/tftpboot/menu.lst/templates/$1"
PCNAME="$(hostname)"

PROG="$(basename $0)"
if [ "$*" == "help" ]; then
    ogHelp "$PROG" "$PROG template" \
           "$PROG pxe" \
           "$PROG 01"
    exit
fi


# Control básico de errores.
if [ $# -ne 1 ]; then
	ogRaiseError $OG_ERR_FORMAT "$MSG_ERR_FORMAT: $PROG TEMPLATE_NAME"
        exit $?
fi
if [ ! -e $TEMPLATE ]; then
	ogRaiseError $OG_ERR_NOTFOUND "$MSG_ERR_NOTFOUND: $TEMPLATE"
        exit $?
fi

hose $REPOIP $PORT --out sh -c "echo -ne SET_CLIENTMODE $1 $PCNAME"


