18
18
# CDDL HEADER END
19
19
20
20
#
21
- # Copyright (c) 2008, 2017 , Oracle and/or its affiliates. All rights reserved.
21
+ # Copyright (c) 2008, 2018 , Oracle and/or its affiliates. All rights reserved.
22
22
# Portions Copyright (c) 2017-2018, Chris Fraire <[email protected] >.
23
23
#
24
24
@@ -133,6 +133,8 @@ Supported Environment Variables for configuring the default setup:
133
133
(by default 3 directories from SRC_ROOT)
134
134
- OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
135
135
(use "none" to avoid sending it to web app)
136
+ - OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp
137
+ (by default /source).
136
138
- OPENGROK_WPREFIX Disable wildcard prefix search query support (*)
137
139
- OPENGROK_TAG Enable parsing of revision tags into the History
138
140
view
@@ -983,8 +985,30 @@ DeployWar()
983
985
FatalError " Missing Deployment Directory ${warTarget} "
984
986
fi
985
987
988
+ APP_CONTEXT=" source"
989
+ FINAL_WAR_NAME=" source"
990
+ if [ " $applicationServer " = " Tomcat" ]
991
+ then
992
+ if [ ! -z ${OPENGROK_WEBAPP_CONTEXT+x} ] # OPENGROK_WEBAPP_CONTEXT is set
993
+ then
994
+ APP_CONTEXT=" ${OPENGROK_WEBAPP_CONTEXT} "
995
+
996
+ # strip leading /
997
+ case ${APP_CONTEXT} in
998
+ /* ) APP_CONTEXT=` echo ${APP_CONTEXT} | sed ' s|^/||' `
999
+ esac
1000
+
1001
+ FINAL_WAR_NAME=` echo ${APP_CONTEXT} | sed ' s|/|#|g' `
1002
+
1003
+ if [ -z " ${FINAL_WAR_NAME} " ]
1004
+ then
1005
+ FINAL_WAR_NAME=" ROOT"
1006
+ fi
1007
+ fi
1008
+ fi
1009
+
986
1010
Progress " Installing ${OPENGROK_DIST_WAR} to ${warTarget} ..."
987
- ${DO} cp -p " ${OPENGROK_DIST_WAR} " " ${warTarget} /"
1011
+ ${DO} cp -p " ${OPENGROK_DIST_WAR} " " ${warTarget} /${FINAL_WAR_NAME} .war "
988
1012
if [ $? != 0 ]
989
1013
then
990
1014
FatalError " Web Application Installation FAILED"
@@ -1011,7 +1035,7 @@ DeployWar()
1011
1035
if [ -n " ${EXTRACT_COMMAND} " ]
1012
1036
then
1013
1037
cd " ${warTarget} "
1014
- eval " ${EXTRACT_COMMAND} ${warTarget} /source .war WEB-INF/web.xml"
1038
+ eval " ${EXTRACT_COMMAND} ${warTarget} /${FINAL_WAR_NAME} .war WEB-INF/web.xml"
1015
1039
if [ " ${OPENGROK_INSTANCE_BASE} " != ' /var/opengrok' ]
1016
1040
then
1017
1041
sed -e ' s:/var/opengrok/etc/configuration.xml:' " $XML_CONFIGURATION " ' :g' \
@@ -1028,7 +1052,7 @@ DeployWar()
1028
1052
mv " ${warTarget} /WEB-INF/web.xml.tmp" \
1029
1053
" ${warTarget} /WEB-INF/web.xml"
1030
1054
fi
1031
- eval " ${COMPRESS_COMMAND} ${warTarget} /source .war WEB-INF/web.xml"
1055
+ eval " ${COMPRESS_COMMAND} ${warTarget} /${FINAL_WAR_NAME} .war WEB-INF/web.xml"
1032
1056
rm -rf " ${warTarget} /WEB-INF"
1033
1057
fi
1034
1058
fi
@@ -1039,7 +1063,7 @@ DeployWar()
1039
1063
Progress " running, or wait until it loads the just installed web " \
1040
1064
" application."
1041
1065
Progress
1042
- Progress " OpenGrok should be available on <HOST>:<PORT>/source "
1066
+ Progress " OpenGrok should be available on <HOST>:<PORT>/${APP_CONTEXT} "
1043
1067
Progress " where HOST and PORT are configured in ${applicationServer} ."
1044
1068
Progress
1045
1069
}
0 commit comments