#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/lib/nim/methods/set_console.script.sh 1.1 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2010 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 

echo 'CuAt:'>/tmp/cuat.out
echo '       name = "sys0"'>>/tmp/cuat.out
echo '       attribute = "syscons"'>>/tmp/cuat.out
echo '       value = "/dev/vty0"'>>/tmp/cuat.out
echo '       type = "R"'>>/tmp/cuat.out
echo '       generic = ""'>>/tmp/cuat.out
echo '       rep = "s"'>>/tmp/cuat.out
echo '       nls_index = 0'>>/tmp/cuat.out

cd /etc/objrepos
if [[ -f CuAt.copy ]]
then
	printf "Backup Copy of CuAt ODM Exists\n"
else
	printf "Saving Copy of CuAt ODM\n"
	cp CuAt CuAt.copy
fi

if [[ -f /tmp/cuat.out ]]
then
	odmget -q "name='sys0' and attribute like syscons" CuAt
	printf "Deleting CuAt Stanza\n"
	odmdelete -o CuAt -q "name='sys0' and attribute like syscons"
	printf "Updating CuAt ODM\n"
	odmadd /tmp/cuat.out
	printf "Check New ODM Setting"
	odmget -q "name='sys0' and attribute like syscons" CuAt
else
	printf "Stanza update file does not exist, /tmp/cuat.out!\n"
fi
