#!/bin/bash
# Ahsay Offsite Backup Server and Replication Server 
# Version: 5.5.1.0

# This is a script file to be executed after installation

###############################################################################
#       D E F I N E           P A T H       A N D        N A M E S            #
###############################################################################

# $1 is the timestamp
TIMESTAMP_CONFIG=$1

JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home

###############################################################################
#       D E F I N E          D E P L O Y M E N T       C O N S T A N T S      #
###############################################################################

# Define APP_NAME for current installation
APP_NAME="Ahsay Offsite Backup Server and Replication Server"

# Define APP_HOME for current installation
APP_HOME="/Applications/AhsayOBS and AhsayRPS"

# Define SERVICE_NAME for current installation
SERVICE_NAME="AhsayOBS and AhsayRPS"

# Define PKG_NAME for current installation
PKG_NAME="obsr.pkg"

###############################################################################
#       C O F I G U R E         A P P L I C A T I O N        H O M E          #
###############################################################################

echo "Log Time: ${TIMESTAMP_CONFIG}"
echo "Begin Custom Configuration for ${APP_NAME}"

echo "Restore ${APP_HOME} folder ownership"
chown -R root:admin "${APP_HOME}"
echo "Restored default ownership root:admin at ${APP_HOME}"

echo "Disable uninstall.sh to non sudo-ers"
chmod 700 "${APP_HOME}/bin/uninstall.sh"
echo "Changed file permission to 700 for ${APP_HOME}/bin/uninstall.sh"

###############################################################################
#           C O F I G U R E          J A V A            H O M E               #
###############################################################################

ln -sf "${JAVA_HOME}" "${APP_HOME}/java"

###############################################################################
#             E N D            O F            C O N F I G U R A T I O N       #
###############################################################################

echo "Finished Custom Configuration for ${APP_NAME}"

