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

97 lines
2.5 KiB
Bash
Raw Normal View History

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 [-f |-h] \n"
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
f) force=false;;
h) showhelp
exit 0 ;;
\?) echo -e "\nERROR:invalid option: -$OPTARG";
showhelp;
echo -e "\naborting.\n"
exit 1 >&2 ;;
esac
done
echo ""
if $force; then
echo "Creating tomcat symlink..."
ln -s apache-tomcat-${TOMCAT_VERSION} ${TOMCAT_DST_FOLDER}
echo "Created"
ls -l ${TOMCAT_DST_FOLDER}
echo "Adding the following variables to environment..."
echo "${ENV_VARIABLES}"
echo "${ENV_VARIABLES}" >> ~/.bashrc
echo ""
echo "Loading new environment..."
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 -e "\n\n\n\n"
echo "Just few steps to do to reach the goal:"
else
echo "Create tomcat symlink with the following command"
echo "ln -s apache-tomcat-${TOMCAT_VERSION} ${TOMCAT_DST_FOLDER}"
echo ""
echo "Add the following variables to your ~/.bashrc"
echo "${ENV_VARIABLES}"
echo ""
echo "Load new variables with the following command"
echo "source ~/.bashrc"
echo ""
echo "Enter on SmartGear Distribution Directory " ${SMARTGEAR_DISTRIBUTION_DIRECTORY}
echo "cd ${SMARTGEAR_DISTRIBUTION_DIRECTORY}"
echo ""
echo "Launch SmartGear install for Tomcat...."
echo "./install -s tomcat"
echo -e "\n\n\n\n"
echo "Then:"
fi
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"