smartgears-distribution-bundle/src/resources/setup.sh

76 lines
2.2 KiB
Bash
Raw Normal View History

#!/bin/bash
TOMCAT_DST_FOLDER="tomcat"
TOMCAT_VERSION="${tomcat.version}"
TOMCAT_PID_FILENAME="pid.txt"
SMARTGEAR_DISTRIBUTION_DIRECTORY="smartgears-distribution-${smartgear.version}"
SMARTGEAR_ROOT=${PWD}
GHN_HOME=${SMARTGEAR_ROOT}/${SMARTGEAR_DISTRIBUTION_DIRECTORY}
CONTAINER_FILENAME="container.xml"
CONTAINER_XML=${GHN_HOME}/${CONTAINER_FILENAME}
ENV_VARIABLES="export CATALINA_OPTS=\"-Xmx2000m -Xms2000m\"
export GHN_HOME=${GHN_HOME}
export CATALINA_PID=${SMARTGEAR_ROOT}/${TOMCAT_PID_FILENAME}
export CATALINA_HOME=${SMARTGEAR_ROOT}/${TOMCAT_DST_FOLDER}"
function showhelp {
echo -e "\nUsage: setup.sh [-d <distro directory>] [-f |-h] \n"
echo " <distro directory> = the directory where installing SmartGear"
echo " By default, this is the directory of this script."
echo " f = Really run the setup. By default it will be a dry-run"
echo -e " h = shows this help.\n"
}
while getopts ":d:fh" opt; do
case $opt in
d) distro=$OPTARG;;
f) force="true";;
h) showhelp
exit 0 ;;
:) echo -e "\nERROR:option -$OPTARG requires an argument." >&2 ;
showhelp;
echo -e "\naborting.\n"
exit 1;;
\?) echo -e "\nERROR:invalid option: -$OPTARG";
showhelp;
echo -e "\naborting.\n"
exit 1 >&2 ;;
esac
done
echo "Creating tomcat symlink..."
ln -s apache-tomcat-${TOMCAT_VERSION} ${TOMCAT_DST_FOLDER}
ls -l ${TOMCAT_DST_FOLDER}
echo ""
echo "Adding the following variables to environment..."
echo "${ENV_VARIABLES}"
echo "${ENV_VARIABLES}" >> pippo.txt
#echo ${ENV_VARIABLES} >> ~/.bashrc
#source ~/.bashrc
echo ""
echo "Entering on SmartGear Distribution Directory " ${SMARTGEAR_DISTRIBUTION_DIRECTORY}
cd ${SMARTGEAR_DISTRIBUTION_DIRECTORY}
echo ""
echo "Launching SmartGear install for Tomcat...."
#./install -s tomcat
echo ""
echo "Just few steps to do to reach the goal:"
echo "- Modify ${CONTAINER_XML} with your hostname"
echo "- Modify ${CONTAINER_XML} startup infrastructure and vres"
CATALINA_STARTUP_SCRIPT="${TOMCAT_DST_FOLDER}/bin/startup.sh"
echo "- Launch tomcat from ${SMATGEAR_ROOT} using the command ${CATALINA_STARTUP_SCRIPT}"
echo ""
echo "By default tomcat start on 8080 port.
If you want to change this port REMEMBER to modify ${CONTAINER_XML} consistently"