#!/bin/sh

CHMOD=chmod
CHOWN=chown

if [ `id -u` -ne 0 ] 
then
  echo "You must be root to run this script"
  exit 1
fi

__File2Chk=`/opt/siebel/bin/sbsp-config --confvars | grep KeyFilePath | awk -F '=' '{print $2}' 2>/dev/null`

if [ ! -z $__File2Chk ]
then
  if [ -f $__File2Chk ]
  then
    echo -n "Changing permissions to file $__File2Chk "
    chmod 600 $__File2Chk && chown 0:0 $__File2Chk && __result="OK"
    if [ "$__result" = "OK" ] 
    then 
      echo "$__result"
    fi
  fi
fi

echo -n "Changing permissions to KEY catalog - "  
chmod -R go-rwx /etc/opt/siebel/key/* 2> /dev/null
chown -R 0:0 /etc/opt/siebel/key 2> /dev/null
echo "Done"

echo "Exiting"


