因为我们都知道,liferay有2个版本,一个是enterprise edition,一个是community edition版本,他们部分代码的实现逻辑是不同的,从而也会影响到我们最终的应用。所以我们必须让tarball智能的获取我们下载的liferay tomcat zip文件是那个版本:
- #resolve the name of the tomcat zip bundle
- LIFERAY_TOMCAT_BUNDLE_ZIPFILE_NAME=${LIFERAY_TOMCAT_BUNDLE_DOWNLOAD_ADDR##*/}
- LIFERAY_TOMCAT_BUNDLE_FOLDER_NAME=${LIFERAY_TOMCAT_BUNDLE_ZIPFILE_NAME%.zip}
- echo "the folder name after unzipping the liferay tombat bundle zip file is $LIFERAY_TOMCAT_BUNDLE_FOLDER_NAME"
- #the liferay-tomcat-bundle-information
- #make conclusion whether the liferay server is a Enterprise Edition or Community Edition
- #the wildcard of the liferay communication edition string and the liferay enterprise editon string
- LIFERAY_CE_STRING=".ce.ga"
- LIFERAY_EE_STRING=".ee.ga"
- #declare some shell variables for conclusion
- declare -i IS_LIFERAY_CE
- declare -i IS_LIFERAY_EE
- declare -i ZERO
- IS_LIFERAY_CE=`echo $LIFERAY_TOMCAT_BUNDLE_DOWNLOAD_ADDR | grep $LIFERAY_CE_STRING | wc -l`
- IS_LIFERAY_EE=`echo $LIFERAY_TOMCAT_BUNDLE_DOWNLOAD_ADDR | grep $LIFERAY_EE_STRING | wc -l`
- ZERO=0
- if [ "$IS_LIFERAY_CE" -gt "$ZERO" ];
- then
- LIFERAY_SERVER_TYPE=ce
- echo "liferay bundle is a community edition"
- fi
- if [ "$IS_LIFERAY_EE" -gt "$ZERO" ];
- then
- LIFERAY_SERVER_TYPE=ee
- echo "liferay bundle is an enterprise edition"
- fi
思路也很清晰,分析下载地址,先去除所有的路径名,只得到zip文件的文件名,然后判断这个文件名是否有".ce.ga"或者".ee.ga"字眼,从而分辨出这个zip包的类型。不在详述。
本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/979806,如需转载请自行联系原作者