#!/bin/sh
######################################################################
# I don't promise this will definitely work, but here's how I got my 
# ubuntu 8.10 x86_64 box to run as a dataprotector (DP 6.1) cell manager.
#
# There are a few issues which I haven't been bothered to fix yet:
#  - it would be nice to have an upstart configuration file
#  - should add entries in /etc/cron.d to run omnitrig, otherwise scheduled
#   backup jobs don't work
#
# Greg Baker < gregb at ifost full-stop org full-stop au >
# 
# P.S. You're reading a shell script. You care deeply about dataprotector
# on Linux. Here's a custom search engine for DataProtector stuff:
#  http://www.ifost.org.au/Documents#dp-search
# 
######################################################################

# Download Linux x86, which will save as B6960-15005.tar.gz
sudo apt-get install alien libstdc++5
tar xvfz B6960-15005.tar.gz 
cd B6960-15005/linux_x86_64/DP_DEPOT
sudo alien --install DP_A0610_GPLx86_64.rpm
sudo mkdir -p /etc/rc.d/rc1.d
sudo mkdir -p /etc/rc.d/rc2.d
sudo mkdir -p /etc/rc.d/rc3.d
sudo mkdir -p /etc/rc.d/rc4.d
sudo mkdir -p /etc/rc.d/rc5.d
sudo mkdir -p /etc/rc.d/rc6.d
# done core, cs, cc
for file in /opt/omni/*.rpm
do
 sudo alien --scripts --install $file
done
sudo ln -s /opt/omni/java/server/bin/libmsg.so /usr/lib
sudo ln -s /opt/omni/java/server/bin/libblcore.so /usr/lib
sudo ln -s /opt/omni/java/server/bin/libOvBbc.so /usr/lib
sudo ln -s /opt/omni/java/server/bin/libOvSecCore.so /usr/lib
sudo ln -s /opt/omni/java/server/bin/libOvXpl.so /usr/lib
sudo ln -s /opt/omni/java/server/bin/libmanager.so /usr/lib

sudo mkdir /var/opt/OV
sudo mkdir /var/opt/OV/log
sudo mkdir /var/opt/OV/tmp
sudo mkdir /var/opt/OV/conf
sudo mkdir /var/opt/OV/conf/xpl
sudo mkdir /var/opt/OV/conf/xpl/log

echo omni 5555/tcp >> /etc/services
cat > /etc/xinetd.d/omni <<EOF
service omni
{
	disable		= no
	id		= omni
	socket_type	= stream
	protocol	= tcp
	user		= root
	wait		= no
 	server		= /opt/omni/lbin/inet
	server_args	= -log /var/opt/omni/log/inet.log
	port		= 5555
}   
EOF




sudo /opt/omni/sbin/omnisv.sh start
sudo /opt/omni/sbin/omnidbinit

cat > omni.sh <<EOF
PATH=$PATH:/opt/omni/bin
EOF

sudo mv omni.sh /etc/profile.d/omni
sudo chmod a+rx /etc/profile.d/omni
sudo chown root /etc/profile.d/omni


# xomni isn't installed, it appears when you
# first run /opt/omni/java/client/bin/javadpgui.sh
# as root. (I think.)


