Author: markt Date: Tue Jul 3 16:10:02 2018 New Revision: 1834998 URL: http://svn.apache.org/viewvc?rev=1834998&view=rev Log: Copy standard code to determine CATALINA_HOME from other scripts. Use setlocal so changes env variables don't persist outside the script. Use standard name, CATALINA_HOME
Modified: tomcat/trunk/bin/makebase.bat Modified: tomcat/trunk/bin/makebase.bat URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/makebase.bat?rev=1834998&r1=1834997&r2=1834998&view=diff ============================================================================== --- tomcat/trunk/bin/makebase.bat (original) +++ tomcat/trunk/bin/makebase.bat Tue Jul 3 16:10:02 2018 @@ -24,6 +24,24 @@ rem the target directory as well. rem rem Usage: makebase <path-to-target-directory> +setlocal + +rem Guess CATALINA_HOME if not defined +set "CURRENT_DIR=%cd%" +if not "%CATALINA_HOME%" == "" goto gotHome +set "CATALINA_HOME=%CURRENT_DIR%" +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +cd .. +set "CATALINA_HOME=%cd%" +cd "%CURRENT_DIR%" +:gotHome + +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto EOF +:okHome + rem first arg is the target directory set BASE_TGT=%1 @@ -33,9 +51,6 @@ if %BASE_TGT%.==. ( goto :EOF ) -set CURR_DIR=%~dp0 -set HOME_DIR=%CURR_DIR%..\ - if exist %BASE_TGT% ( rem target directory exists echo Target directory exists @@ -56,10 +71,10 @@ for %%d in (bin, lib, logs, temp, webapp ) rem copy conf directory -robocopy %HOME_DIR%\conf %BASE_TGT%\conf > nul +robocopy %CATALINA_HOME%\conf %BASE_TGT%\conf > nul rem copy setenv.bat if exists -robocopy %HOME_DIR%\bin %BASE_TGT%\bin setenv.bat > nul +robocopy %CATALINA_HOME%\bin %BASE_TGT%\bin setenv.bat > nul echo Created CATALINA_BASE directory at %BASE_TGT% --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org