refs #77: Improve setup for smartgears-distribution-bundle
https://support.d4science.org/issues/77 Added the possibility to specify hostname as paramenter which is filled in container.xml. Furthermore the hostname is requested during the setup process. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/smartgears-distribution-bundle@122168 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c5bcb3d4e6
commit
e31975b09c
6
pom.xml
6
pom.xml
|
@ -22,7 +22,7 @@
|
|||
<tomcat.version>7.0.64</tomcat.version>
|
||||
<!-- This property MUST be passed as argument from command line
|
||||
i.e. mvn compile -Dsmartgears-distribution.version=1.2.5-SNAPSHOT
|
||||
<smartgears-distribution.version>1.2.5-SNAPSHOT</smartgears-distribution.version>
|
||||
<smartgears-distribution.version>1.2.6-SNAPSHOT</smartgears-distribution.version>
|
||||
-->
|
||||
<resourcesDirectory>src/resources</resourcesDirectory>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<type>tar.gz</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -117,7 +117,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${basedir}/${targetDirectory}/${smartgearsDirectory}</outputDirectory>
|
||||
<excludeTypes>war</excludeTypes>
|
||||
<excludeTypes>jar,war</excludeTypes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -19,18 +19,66 @@ export CATALINA_PID=${SMARTGEAR_ROOT}/${TOMCAT_PID_FILENAME}
|
|||
export CATALINA_HOME=${SMARTGEAR_ROOT}/${TOMCAT_DST_FOLDER}
|
||||
export BUNDLE_HOME=${SMARTGEAR_ROOT}"
|
||||
|
||||
|
||||
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"
|
||||
echo -e "\nUsage: setup.sh [-n <hostname>] [-f | -h] \n"
|
||||
echo " -n <hostname> = The hostname to set in container.xml"
|
||||
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
|
||||
function hostname {
|
||||
local DOMAIN=$(/bin/domainname)
|
||||
local HOSTNAME=$(/bin/hostname)
|
||||
|
||||
if [ -z "$HOST" ]; then
|
||||
HOST=${HOSTNAME}.${DOMAIN}
|
||||
fi
|
||||
|
||||
local HOST_OK=false
|
||||
|
||||
while [ "$HOST_OK" = false ]
|
||||
do
|
||||
|
||||
echo "Is ${HOST} correct?"
|
||||
select yn in "Yes" "No";
|
||||
do
|
||||
case $yn in
|
||||
Yes )
|
||||
ok=true
|
||||
HOST_OK=true;
|
||||
break;;
|
||||
No )
|
||||
ok=false
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$ok" = false ]; then
|
||||
read -p "Please input the hostname [followed by ENTER]: " HOST
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
function escape_slashes {
|
||||
sed 's/\//\\\//g'
|
||||
}
|
||||
|
||||
function change_line {
|
||||
local OLD_LINE_PATTERN=$1; shift
|
||||
local NEW_LINE=$1; shift
|
||||
local FILE=$1
|
||||
|
||||
local NEW=$(echo "${NEW_LINE}" | escape_slashes)
|
||||
sed -i '/'"${OLD_LINE_PATTERN}"'/s/.*/'"${NEW}"'/' "${FILE}"
|
||||
}
|
||||
|
||||
while getopts ":n:fh" opt; do
|
||||
case $opt in
|
||||
f) force=true;;
|
||||
n) HOST=$OPTARG;;
|
||||
f) force=true;;
|
||||
h) showhelp
|
||||
exit 0 ;;
|
||||
exit 0 ;;
|
||||
\?) echo -e "\nERROR:invalid option: -$OPTARG";
|
||||
showhelp;
|
||||
echo -e "\naborting.\n"
|
||||
|
@ -69,6 +117,9 @@ if [ $force ]; then
|
|||
|
||||
./install -s tomcat -g ${GHN_HOME}
|
||||
|
||||
hostname
|
||||
change_line "<hostname>" "\t<hostname>$HOST</hostname>" ${CONTAINER_XML}
|
||||
|
||||
echo -e "\n\n\n"
|
||||
echo "Just few steps to do to reach the goal:"
|
||||
|
||||
|
@ -78,9 +129,9 @@ if [ $force ]; then
|
|||
echo -e "\n\n"
|
||||
echo "Then:"
|
||||
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"
|
||||
showhelp
|
||||
|
||||
echo "Here it is the list of steps to setup SmartGear."
|
||||
|
||||
echo ""
|
||||
echo "Create tomcat symlink with the following command:"
|
||||
|
@ -110,20 +161,17 @@ else
|
|||
echo "The previous steps can be made by launching this script with -f option"
|
||||
|
||||
echo -e "\n\n"
|
||||
|
||||
echo "Then:"
|
||||
|
||||
echo "- Modify ${CONTAINER_XML} with your hostname"
|
||||
fi
|
||||
|
||||
|
||||
echo "- Modify ${CONTAINER_XML} with your hostname"
|
||||
echo "- Modify ${CONTAINER_XML} startup infrastructure and vres"
|
||||
|
||||
echo "- You can Start the container from ${BUNDLE_HOME} directory using the command ./${STARTUP_SCRIPT}"
|
||||
echo "- You can Stop the container from ${BUNDLE_HOME} directory using the command ./${STOP_SCRIPT}"
|
||||
|
||||
echo ""
|
||||
echo "PLEASE NOTE:
|
||||
By default Tomcat start on 8080 port. If you want to change this port REMEMBER to modify ${CONTAINER_XML} consistently"
|
||||
|
||||
|
||||
|
||||
echo "PLEASE NOTE:"
|
||||
echo "By default Tomcat start on 8080 port. If you want to change this port REMEMBER to modify ${CONTAINER_XML} consistently"
|
Loading…
Reference in New Issue