#!/bin/sh
# The filemap binaries need to exist under /opt/ORCLfmap/prot1_X where
# X is either 32 for 32-bit Solaris machines and 64 for 64-bit Solaris
# machines.
#
# Other UNIX platforms will have to do something similar  
ORACLE_HOME=/opt/oracle19c/package
. $ORACLE_HOME/install/utl/rootmacro.sh

ORCLFMAPLOC=/opt/ORCLfmap
FILEMAPLOC=$ORCLFMAPLOC/prot1_64 # needs to be prot1_32 for 32 bit platforms

if [ ! -d $ORCLFMAPLOC ];then
$MKDIR $ORCLFMAPLOC
fi
if [ ! -d $FILEMAPLOC ];then
$MKDIR $FILEMAPLOC
fi
if [ ! -d $FILEMAPLOC/bin ];then
$MKDIR $FILEMAPLOC/bin
fi
if [ ! -d $FILEMAPLOC/etc ];then
$MKDIR $FILEMAPLOC/etc
fi
if [ ! -d $FILEMAPLOC/log ];then
$MKDIR $FILEMAPLOC/log
fi

if [ ! -z "$OSDBA_GROUP" ];then
  FMPUTL_GROUP=$OSDBA_GROUP
else
  FMPUTL_GROUP=root
fi

$CP $ORACLE_HOME/bin/fmputl $FILEMAPLOC/bin
$CP $ORACLE_HOME/bin/fmputlhp $FILEMAPLOC/bin
$CHMOD 550 $FILEMAPLOC/bin/fmputl
$CHGRP $FMPUTL_GROUP $FILEMAPLOC/bin/fmputlhp 
$CHMOD 4550 $FILEMAPLOC/bin/fmputlhp
if [ ! -f $FILEMAPLOC/etc/filemap.ora ];then
$CP $ORACLE_HOME/rdbms/install/filemap.ora $FILEMAPLOC/etc
fi
