Skip to content
Snippets Groups Projects
Commit e53def7f authored by Demian Katz's avatar Demian Katz
Browse files

Improve Windows batch file path/environment handling.

parent f01f2d35
No related merge requests found
...@@ -60,17 +60,20 @@ set EXTRA_SOLRMARC_SETTINGS=%EXTRA_SOLRMARC_SETTINGS% -Dsolr.core.name=%SOLRCOR ...@@ -60,17 +60,20 @@ set EXTRA_SOLRMARC_SETTINGS=%EXTRA_SOLRMARC_SETTINGS% -Dsolr.core.name=%SOLRCOR
rem ################################################## rem ##################################################
rem # Set VUFIND_HOME rem # Set VUFIND_HOME
rem ################################################## rem ##################################################
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to rem VUFIND_HOME not set -- try to call env.bat to
rem fix the problem before we give up completely rem fix the problem before we give up completely
if exist env.bat goto useenvbat if exist env.bat goto useenvbat
rem If env.bat doesn't exist, the user hasn't run the installer yet. rem If env.bat doesn't exist, the user hasn't run the installer yet.
echo ERROR: env.bat does not exist -- could not set up environment. echo WARNING: env.bat does not exist -- trying default environment settings.
echo Please run "php install.php" to correct this problem. echo Please run "php install.php" to correct this problem.
goto end rem Extract path from current batch file and trim trailing slash:
set VUFIND_HOME=%~dp0%
set VUFIND_HOME=%VUFIND_HOME:~0,-1%
goto vufindhomefound
:useenvbat :useenvbat
call env > nul call env > nul
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
echo You need to set the VUFIND_HOME environmental variable before running this script. echo You need to set the VUFIND_HOME environmental variable before running this script.
goto end goto end
:vufindhomefound :vufindhomefound
...@@ -78,11 +81,11 @@ goto end ...@@ -78,11 +81,11 @@ goto end
rem ##################################################### rem #####################################################
rem # Build java command rem # Build java command
rem ##################################################### rem #####################################################
if not "!%JAVA_HOME%!"=="!!" goto javahomefound if not (!%JAVA_HOME%!)==(!!) goto javahomefound
set JAVA=java set JAVA=java
goto javaset goto javaset
:javahomefound :javahomefound
set JAVA="%JAVA_HOME%\bin\java" set JAVA=%JAVA_HOME%\bin\java
:javaset :javaset
rem ################################################## rem ##################################################
...@@ -93,6 +96,7 @@ if not exist %VUFIND_LOCAL_DIR%\import\import.properties goto nolocalproperties ...@@ -93,6 +96,7 @@ if not exist %VUFIND_LOCAL_DIR%\import\import.properties goto nolocalproperties
set PROPERTIES_FILE=%VUFIND_LOCAL_DIR%\import\import.properties set PROPERTIES_FILE=%VUFIND_LOCAL_DIR%\import\import.properties
goto propertiesfound goto propertiesfound
:nolocalproperties :nolocalproperties
echo WARNING: VUFIND_LOCAL_DIR environment variable is not set. Is this intentional?
set PROPERTIES_FILE=%VUFIND_HOME%\import\import.properties set PROPERTIES_FILE=%VUFIND_HOME%\import\import.properties
:propertiesfound :propertiesfound
...@@ -112,4 +116,4 @@ echo %RUN_CMD% ...@@ -112,4 +116,4 @@ echo %RUN_CMD%
:end :end
rem We're all done -- close down the local environment. rem We're all done -- close down the local environment.
endlocal endlocal
\ No newline at end of file
...@@ -12,32 +12,35 @@ goto end ...@@ -12,32 +12,35 @@ goto end
rem ################################################## rem ##################################################
rem # Set SOLR_HOME rem # Set SOLR_HOME
rem ################################################## rem ##################################################
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to rem VUFIND_HOME not set -- try to call env.bat to
rem fix the problem before we give up completely rem fix the problem before we give up completely
if exist env.bat goto useenvbat if exist env.bat goto useenvbat
rem If env.bat doesn't exist, the user hasn't run the installer yet. rem If env.bat doesn't exist, the user hasn't run the installer yet.
echo ERROR: env.bat does not exist -- could not set up environment. echo WARNING: env.bat does not exist -- trying default environment settings.
echo Please run install.php to correct this problem. echo Please run "php install.php" to correct this problem.
goto end rem Extract path from current batch file and trim trailing slash:
set VUFIND_HOME=%~dp0%
set VUFIND_HOME=%VUFIND_HOME:~0,-1%
goto vufindhomefound
:useenvbat :useenvbat
call env > nul call env > nul
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
echo You need to set the VUFIND_HOME environmental variable before running this script. echo You need to set the VUFIND_HOME environmental variable before running this script.
goto end goto end
:vufindhomefound :vufindhomefound
if not "!%SOLR_HOME%!"=="!!" goto solrhomefound if not (!%SOLR_HOME%!)==(!!) goto solrhomefound
set SOLR_HOME=%VUFIND_HOME%\solr\vufind set SOLR_HOME=%VUFIND_HOME%\solr\vufind
:solrhomefound :solrhomefound
rem ##################################################### rem #####################################################
rem # Build java command rem # Build java command
rem ##################################################### rem #####################################################
if not "!%JAVA_HOME%!"=="!!" goto javahomefound if not (!%JAVA_HOME%!)==(!!) goto javahomefound
set JAVA=java set JAVA=java
goto javaset goto javaset
:javahomefound :javahomefound
set JAVA="%JAVA_HOME%\bin\java" set JAVA=%JAVA_HOME%\bin\java
:javaset :javaset
cd %VUFIND_HOME%\import cd %VUFIND_HOME%\import
......
...@@ -40,17 +40,20 @@ rem Unrecognized action -- display help text ...@@ -40,17 +40,20 @@ rem Unrecognized action -- display help text
if "!%1!"=="!!" goto usage if "!%1!"=="!!" goto usage
rem Set VUFIND_HOME (if not already set) rem Set VUFIND_HOME (if not already set)
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
rem VUFIND_HOME not set -- try to call env.bat to rem VUFIND_HOME not set -- try to call env.bat to
rem fix the problem before we give up completely rem fix the problem before we give up completely
if exist env.bat goto useenvbat if exist env.bat goto useenvbat
rem If env.bat doesn't exist, the user hasn't run the installer yet. rem If env.bat doesn't exist, the user hasn't run the installer yet.
echo ERROR: env.bat does not exist -- could not set up environment. echo WARNING: env.bat does not exist -- trying default environment settings.
echo Please run "php install.php" to correct this problem. echo Please run "php install.php" to correct this problem.
goto end rem Extract path from current batch file and trim trailing slash:
set VUFIND_HOME=%~dp0%
set VUFIND_HOME=%VUFIND_HOME:~0,-1%
goto vufindhomefound
:useenvbat :useenvbat
call env > nul call env > nul
if not "!%VUFIND_HOME%!"=="!!" goto vufindhomefound if not (!%VUFIND_HOME%!)==(!!) goto vufindhomefound
echo You need to set the VUFIND_HOME environmental variable before running this script. echo You need to set the VUFIND_HOME environmental variable before running this script.
goto end goto end
:vufindhomefound :vufindhomefound
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment