Skip to content

Commit 6c97dcf

Browse files
committed
get rid of GNU sed'ism so that file substitution works on all platforms
fixes #1781
1 parent d5abd60 commit 6c97dcf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

OpenGrok

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,10 @@ DeployWar()
915915
FatalError "Web Application Installation FAILED"
916916
fi
917917

918-
# Fix for opengrok issue https://github.com/OpenGrok/OpenGrok/issues/863
919918
# If user does not use default OPENGROK_INSTANCE_BASE or default
920919
# WEBAPP_CONFIG_ADDRESS, then attempt to extract WEB-INF/web.xml from
921920
# source.war using jar or zip utility, update the hardcoded values and
922921
# then update source.war with the new WEB-INF/web.xml
923-
924922
if [ "${OPENGROK_INSTANCE_BASE}" != '/var/opengrok' ] || [ "${WEBAPP_CONFIG_ADDRESS}" != 'localhost:2424' ]
925923
then
926924
EXTRACT_COMMAND=""
@@ -941,11 +939,19 @@ DeployWar()
941939
eval "${EXTRACT_COMMAND} ${warTarget}/source.war WEB-INF/web.xml"
942940
if [ "${OPENGROK_INSTANCE_BASE}" != '/var/opengrok' ]
943941
then
944-
sed -i -e 's:/var/opengrok/etc/configuration.xml:'"$XML_CONFIGURATION"':g' "${warTarget}/WEB-INF/web.xml"
942+
sed -e 's:/var/opengrok/etc/configuration.xml:'"$XML_CONFIGURATION"':g' \
943+
"${warTarget}/WEB-INF/web.xml" \
944+
> "${warTarget}/WEB-INF/web.xml.tmp"
945+
mv "${warTarget}/WEB-INF/web.xml.tmp" \
946+
"${warTarget}/WEB-INF/web.xml"
945947
fi
946948
if [ "${WEBAPP_CONFIG_ADDRESS}" != 'localhost:2424' ]
947949
then
948-
sed -i -e 's/localhost:2424/'"$WEBAPP_CONFIG_ADDRESS"'/g' "${warTarget}/WEB-INF/web.xml"
950+
sed -e 's/localhost:2424/'"$WEBAPP_CONFIG_ADDRESS"'/g' \
951+
"${warTarget}/WEB-INF/web.xml" \
952+
> "${warTarget}/WEB-INF/web.xml.tmp"
953+
mv "${warTarget}/WEB-INF/web.xml.tmp" \
954+
"${warTarget}/WEB-INF/web.xml"
949955
fi
950956
eval "${COMPRESS_COMMAND} ${warTarget}/source.war WEB-INF/web.xml"
951957
rm -rf "${warTarget}/WEB-INF"

0 commit comments

Comments
 (0)