[15606] | 1 | @echo off
|
---|
| 2 |
|
---|
[24870] | 3 | pushd "%CD%"
|
---|
| 4 | CD /D "%~dp0"
|
---|
| 5 |
|
---|
[15606] | 6 | :: by default, assume English
|
---|
| 7 | set PROGNAME=Fedora Librarian Interface
|
---|
| 8 | if "%GLILANG%" == "es" set PROGNAME=Biblioteca Digital Fedora.
|
---|
| 9 | if "%GLILANG%" == "fr" set PROGNAME=Bibliothécaire Fedora.
|
---|
| 10 | if "%GLILANG%" == "ru" set PROGNAME=ÉÎÔÅÒÆÅÊÓ Fedora.
|
---|
| 11 | :: How to export PROGNAME?
|
---|
| 12 |
|
---|
| 13 | set PROGNAME_EN=Fedora Librarian Interface
|
---|
| 14 | set PROGABBR=FLI
|
---|
| 15 |
|
---|
| 16 |
|
---|
[16470] | 17 | echo.
|
---|
| 18 | :: Test to see if FEDORA_HOME environment variable has been set up
|
---|
| 19 | if "%FEDORA_HOME%" == "" goto noFed
|
---|
| 20 | :: Check if the directory FEDORA_HOME exists
|
---|
[15606] | 21 | :: MAN: Can't use the if command to test directly for a directory, but the null (NUL) device does exist in
|
---|
| 22 | :: every directory. As a result, you can test for the null device to determine whether a directory exists.
|
---|
[16470] | 23 | if not exist %FEDORA_HOME%\nul echo Error: Cannot find Fedora home. No such directory: %FEDORA_HOME%
|
---|
| 24 | if not exist %FEDORA_HOME%\nul goto exit
|
---|
| 25 |
|
---|
| 26 | :: If FEDORA_VERSION not set, default fedora-version to 3 after warning user.
|
---|
| 27 | if not "%FEDORA_VERSION%" == "" goto runFed
|
---|
| 28 | echo FEDORA_VERSION (major version of Fedora) was not set. Defaulting to: 3.
|
---|
| 29 | echo If you are running a different version of Fedora, set the FEDORA_VERSION
|
---|
| 30 | echo environment variable.
|
---|
| 31 | set FEDORA_VERSION="3"
|
---|
| 32 | echo.
|
---|
[15606] | 33 |
|
---|
| 34 |
|
---|
[16470] | 35 | :runFed
|
---|
| 36 | :: MAN: The %* batch parameter is a wildcard reference to all the arguments, not including %0,
|
---|
| 37 | :: that are passed to the batch file.
|
---|
| 38 | echo FEDORA_HOME: %FEDORA_HOME%.
|
---|
| 39 | echo FEDORA_VERSION: %FEDORA_VERSION%
|
---|
[24870] | 40 | call gli.bat -fedora -fedora_home %FEDORA_HOME% -fedora_version %FEDORA_VERSION% %*
|
---|
| 41 | goto exit
|
---|
[15606] | 42 |
|
---|
[16470] | 43 | :: Either (or both) of FEDORA_HOME and FEDORA_VERSION were not set, both are crucial
|
---|
| 44 | :noFed
|
---|
| 45 | echo Error: Cannot run %PROGNAME_EN% (%PROGABBR%) if FEDORA_HOME is not set.
|
---|
| 46 | goto exit
|
---|
[15606] | 47 |
|
---|
| 48 |
|
---|
| 49 | :exit
|
---|
| 50 | echo.
|
---|
| 51 | pause
|
---|
| 52 |
|
---|
| 53 | :done
|
---|
| 54 | :: ---- Clean up ----
|
---|
| 55 | set PROGNAME_EN=
|
---|
| 56 | set PROGABBR=
|
---|
[16470] | 57 | set PROGNAME=
|
---|
[24870] | 58 |
|
---|
| 59 | popd
|
---|