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