#!/bin/sh

SCRIPT_PATH=$( cd $(dirname $0) ; pwd )
cd "${SCRIPT_PATH}"

echo "BombaDB Classic Edition Installer In Progress..."
echo "${SCRIPT_PATH}"

mkdir -p "/usr/db"
mkdir -p "/usr/db/bombadb"
mkdir -p "/usr/share/bombadb"
mkdir -p "/etc/bombadb"

if [ -d /usr/share/bombadb ]; then
if [ -f /usr/share/bombadb/lang.conf ]; then
cp -r ${SCRIPT_PATH}/lang.conf /usr/share/bombadb;
echo "LANG.CONF REPLACED CORRECTELLY !"
else
cp -r ${SCRIPT_PATH}/lang.conf /usr/share/bombadb;
echo "LANG.CONF INSTALLED CORRECTELLY !"
fi
fi


if [ -d /usr/lib ]; then
if [ -f /usr/lib/bomba_exit.so ]; then
cp -r ${SCRIPT_PATH}/*.so /usr/lib;
echo "BOMBADB LIBRARIES REPLACED CORRECTELLY !"
else
cp -r ${SCRIPT_PATH}/*.so /usr/lib;
echo "BOMBADB LIBRARIES INSTALLED CORRECTELLY !"
fi
fi


chmod 755 /usr/lib/*.so
chmod 644 /usr/share/bombadb/

cd --
printf "Done !\n"

exit 0
