diff --git a/tests/p_tomcat/0-install_tomcat.sh b/tests/p_tomcat/0-install_tomcat.sh index e726041..7335b26 100755 --- a/tests/p_tomcat/0-install_tomcat.sh +++ b/tests/p_tomcat/0-install_tomcat.sh @@ -1,11 +1,13 @@ #!/bin/bash # Author: Athmane Madjoudj -if (t_GetPkgRel basesystem | grep -q el6) -then - t_Log "$0 - installing Tomcat 6" - t_InstallPackage tomcat6 tomcat6-admin-webapps tomcat6-webapps +if [ "$centos_ver" = "7" ] ;then + tomcat_packages="tomcat tomcat-admin-webapps tomcat-webapps" +elif [ "$centos_ver" = "6" ]; then + tomcat_packages="tomcat6 tomcat6-admin-webapps tomcat6-webapps" else - t_Log "$0 - installing Tomcat 5" - t_InstallPackage tomcat5 tomcat5-admin-webapps tomcat5-webapps + tomcat_packages="tomcat5 tomcat5-admin-webapps tomcat5-webapps" fi + +t_Log "$0 - installing Tomcat packages" +t_InstallPackage ${tomcat_packages} diff --git a/tests/p_tomcat/1-config_tomcat.sh b/tests/p_tomcat/1-config_tomcat.sh index 850cfa0..a272cdc 100755 --- a/tests/p_tomcat/1-config_tomcat.sh +++ b/tests/p_tomcat/1-config_tomcat.sh @@ -3,8 +3,10 @@ t_Log "$0 - Configuring Tomcat" -if (t_GetPkgRel basesystem | grep -q el6) -then +if [ "$centos_ver" = "7" ] ;then + TOMCAT_SRV_NAME=tomcat + TOMCAT_CONF_DIR=/etc/tomcat/ +elif [ "$centos_ver" = "6" ] ; then TOMCAT_SRV_NAME=tomcat6 TOMCAT_CONF_DIR=/etc/tomcat6/ else @@ -12,8 +14,11 @@ else TOMCAT_CONF_DIR=/etc/tomcat5/ fi -sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml - +if [ "$centos_ver" = "7" ] ;then + sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml +else + sed -i 's/<\/tomcat-users>/\n<\/tomcat-users>/' $TOMCAT_CONF_DIR/tomcat-users.xml +fi service $TOMCAT_SRV_NAME restart diff --git a/tests/p_tomcat/tomcat_test.sh b/tests/p_tomcat/tomcat_test.sh index 6329255..3902287 100755 --- a/tests/p_tomcat/tomcat_test.sh +++ b/tests/p_tomcat/tomcat_test.sh @@ -3,6 +3,12 @@ t_Log "Running $0 - Tomcat basic test." -curl -s http://localhost:8080/ | grep "you've setup Tomcat successfully. Congratulations!" >/dev/null 2>&1 +if [ "$centos_ver" = "7" ] ; then + string_tosearch="you've successfully installed Tomcat. Congratulations!" +else + string_tosearch="you've setup Tomcat successfully. Congratulations!" +fi + +curl -s http://localhost:8080/ | grep "${string_tosearch}" >/dev/null 2>&1 t_CheckExitStatus $?