#!/bin/sh

#  NOTE  :  Set up script for Sun Management Center And Unicenter TNG Integration 

ARGS=$# ;

SUNMCPATH=`/usr/bin/pkgparam SUNWescom BASEDIR` ;

SMCPATH=$SUNMCPATH/SUNWsymon/SunMC-TNG ;

SMCBINPATH=$SMCPATH/sbin ;

SMCADMPATH="/var/opt/SUNWsymon/SunMC-TNG";

PROPERTY_FILE_NAME="SunMCToTngAdaptorMain.cfg" ;

LOG_FILE_NAME="SunMCToTngAdaptorMain.log" ;

makepropertiesfile() {

    SUNMC_SERVER_NAME="localhost" ;
    SUNMC_USER_NAME="nobody" ;
    SUNMC_SERVER_PORT_NO="2099";
    TNG_SERVER_NAME="localhost" ;
    TNG_SERVER_PORT_NO="162";
    MOD_POLL_INTERVAL="60";
    HOSTNAME_FORMAT="1";	

propertyfile="
\n# States the log file name in which the daemon information will be logged.\n
LOG_FILE_PATH=$SMCADMPATH/SunMCToTngAdaptorMain.log\n
\n# States the ini file name in which the daemon read init information.\n
INI_FILE_PATH=$SMCADMPATH/SunMCToTngAdapterMain.ini\n
\n# States Sun Management Center Server Name \n
SUNMC_SERVER_NAME=$SUNMC_SERVER_NAME\n
\n# States Sun Management Center Server Port Number. \n
SUNMC_SERVER_PORT_NO=$SUNMC_SERVER_PORT_NO\n
\n# States Unicenter Tng Server Name \n
TNG_SERVERS_NAME=$TNG_SERVERS_NAME\n
\n# States Unicenter Tng Server DSM Trap Port Number Daemon. \n
TNG_SERVER_PORT_NO=$TNG_SERVER_PORT_NO\n
\n# States Sun Management Center User Name. \n
SUNMC_USER_NAME=$SUNMC_USER_NAME\n
\n# States Synchronizer Polling Interval(Seconds). \n
MOD_POLL_INTERVAL=$MOD_POLL_INTERVAL\n
\n# States HostName Format : True Name [0], Short Name [1], IP Address [2].\n
HOSTNAME_FORMAT=$HOSTNAME_FORMAT\n"

echo $propertyfile > $SMCADMPATH/$PROPERTY_FILE_NAME ;
chmod 644 $SMCADMPATH/$PROPERTY_FILE_NAME ;
touch $SMCADMPATH/$LOG_FILE_NAME;
chmod 644 $SMCADMPATH/$LOG_FILE_NAME;

}


makeadmdir() {
      if [ ! -x $SMCADMPATH ] 
      then
      /usr/bin/mkdir -p $SMCADMPATH ;
      /usr/bin/chmod 755 $SMCADMPATH ;
      fi
}

makebindir() {
      if [ ! -x $SMCBINPATH ] 
      then
      /usr/bin/mkdir -p $SMCBINPATH ;
      /usr/bin/chmod 755 $SMCBINPATH ;
      fi
}


makeadmdir ;

makebindir ;

makepropertiesfile ;

exit 0 ;
