#!/bin/sh
# $Id: //depot/prod/capstan/Rcapstan1.1/src/bin/smo_setup.skel#2 $

DEFAULT_ACCOUNT="oracle"
DEFAULT_GROUP="dba"

printf "SMO post installation configuration:\n\n"
printf "OS account that will run SMO [${DEFAULT_ACCOUNT}]: "
read ACCOUNT
ACCOUNT=${ACCOUNT:-${DEFAULT_ACCOUNT}}

printf "OS group that will run SMO [${DEFAULT_GROUP}]: "
read GROUP
GROUP=${GROUP:-${DEFAULT_GROUP}}

smo_dir="/opt/NetApp/smo"

chown -R root:bin ${smo_dir}
chown ${ACCOUNT}:${GROUP} ${smo_dir}/bin/smo

chown root:${GROUP} ${smo_dir}/log
chmod 0770 ${smo_dir}/log
chown root:${GROUP} ${smo_dir}/tmp
chmod 0777 ${smo_dir}/tmp

chmod 1775 ${smo_dir}/profiles

smo_plugin=libplugin_dlm.so
found=0
for agent_dir in /opt/NTAPagent /opt/IBMagent
do
    if [ -d $agent_dir ] ; then
        rm -f $agent_dir/${smo_plugin}
        cp ${smo_dir}/lib/${smo_plugin} $agent_dir/${smo_plugin}
	chmod 755 $agent_dir/${smo_plugin}
	found=1
    fi
done

if [ $found -eq 0 ] ; then
    echo "Warning: Host Agent is not installed on this host." >&2
    echo "Please rerun smo_setup after installing the Host Agent." >&2
else
    echo "Reminder: You must restart the Host Agent after installing Snap Manager for Oracle" >&2
fi

