#!/bin/bash
# *** #########################################################################################
# *** Author: 		ABS Laundry Business Solutions / MBU
# *** Version: 		1.0
# *** #########################################################################################
# ***
# *** Script: 		install_as_root.sh
# *** Description: 	Silent install of Oracle BI 
# *** Author: 		ABS Laundry Business Solutions
# *** Version: 		1.0
# *** Support:		Oracle BI 12.2.1.3 and 12.2.1.4
# *** Remarks:		Upload variable files, configure install_variables.sh abd run with root privileges
# *** Dependencies:	dos2unix
# *** 
# *** ### Changelog of script ################################################################
# *** Date        Author    Version 	Change    
# *** 10-Sep-2019 MBU		1.0			Initial version
##############################################################################################

#*** Initiate package
export PAKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
find $PAKDIR -type f -print | xargs dos2unix
find $PAKDIR -iname \*.sh -type f  -print | xargs chmod 775 
export TMPDIR=$PAKDIR/tmp
export VARDIR=$PAKDIR/variable
export FIXDIR=$PAKDIR/fixed
. $PAKDIR/install_variables.sh

#** Set log files
export BILOG=$PAKDIR/log/biinstall_$(date +"%d-%m-%Y_%H")h$(date +"%M")m.log

#*** Installing BI
$PAKDIR/scripts/bi_root_pre.sh | tee -a $BILOG
su - oracle -c "$PAKDIR/scripts/bi_install.sh" | tee -a $BILOG
$PAKDIR/scripts/bi_root_post.sh | tee -a $BILOG