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=true;; h) showhelp exit 0 ;; \?) echo -e "\nERROR:invalid option: -$OPTARG"; showhelp; echo -e "\naborting.\n" exit 1 >&2 ;; esac done 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" 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 "We are showing the list of steps to setup SmartGear." echo "Use -h to see the script help." echo "Use -f to allow this script to perform automatically the required steps to setup Smartgear" echo "" 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 environments 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 with the following command:" echo "./install -s tomcat" echo "" echo "The previous steps can be made by launching this script with -f option" echo -e "\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"