echo "Running postinstall ..."

echo "Updating configuration files ..."

chmod 755 /opt/HiCommand
chmod 755 $HTMINSTALL
chown root:sys /opt/HiCommand
chown root:sys $HTMINSTALL

JAVA_HOME=/opt/HiCommand/Base/jdk/jre
export JAVA_HOME

if [ -d "/opt/jp1pcwebopt" ]; then
	PR_DIR="/opt/jp1pcwebopt"
elif [ -d "/opt/HiCommand/TuningManager/PerformanceReporter" ]; then
	PR_DIR="/opt/HiCommand/TuningManager/PerformanceReporter"
fi

# echo "Executing: $HTMINSTALL/ant/bin/ant -buildfile $HTMINSTALL/conf/build.xml -Dhttp.port=$HTTPPORT -Ddestination=$HTMINSTALL -Dpwproxy.cm.home=/opt/jp1pc"
$HTMINSTALL/ant/bin/ant -buildfile $HTMINSTALL/conf/build.xml -Dhttp.port=23015 -Ddestination=$HTMINSTALL -Dpwproxy.cm.home=/opt/jp1pc -Dpwproxy.pr.home=$PR_DIR -Dinterbase_path=/usr/interbase -Djdk.root=$JAVA_HOME -Dhicommandbase_root=/opt/HiCommand/Base > /dev/null 2>&1

echo "Done!"

chmod 755 $HTMINSTALL/bin/*
chmod 644 $HTMINSTALL/bin/htm-catalina.sh

echo "Done!"
