1 | echo off
|
---|
2 | pushd "%CD%"
|
---|
3 | CD /D "%~dp0"
|
---|
4 | set GLILANG=en
|
---|
5 |
|
---|
6 | :: This script must be run from within the directory in which it lives
|
---|
7 | if exist makejar.bat goto findJar
|
---|
8 | if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
9 | if "%GLILANG%" == "es" echo Este gui¢n deber ejecutarse desde el directorio en el que reside.
|
---|
10 | if "%GLILANG%" == "fr" echo Ce script doit tre excut
|
---|
11 | partir du rpertoire dans lequel il se trouve.
|
---|
12 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
13 | goto exit
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 | :findJar
|
---|
19 | :: ---- Check jar exists ----
|
---|
20 | set JARPATH=
|
---|
21 |
|
---|
22 | :: Some users may set the above line manually
|
---|
23 | if not "%JARPATH%" == "" goto testJar
|
---|
24 |
|
---|
25 | :: If it is set, use the JAVA_HOME environment variable
|
---|
26 | if not "%JAVA_HOME%" == "" goto javahome
|
---|
27 |
|
---|
28 | :: Check if jar is on the search path
|
---|
29 | echo %PATH%| winutil\which.exe jar.exe | winutil\setvar.exe JARPATH > setjar.bat
|
---|
30 | call setjar.bat
|
---|
31 | del setjar.bat
|
---|
32 | if not "%JARPATH%" == "" goto testJar
|
---|
33 |
|
---|
34 | :: Still haven't found anything, so try looking in the registry (gulp!)
|
---|
35 | type nul > jdk.reg
|
---|
36 | regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
|
---|
37 | type jdk.reg > jdk.txt
|
---|
38 | del jdk.reg
|
---|
39 |
|
---|
40 | winutil\findjava.exe jdk.txt | winutil\setvar.exe JARPATH > setjar.bat
|
---|
41 | del jdk.txt
|
---|
42 | call setjar.bat
|
---|
43 | del setjar.bat
|
---|
44 |
|
---|
45 | :: If nothing was found in the registry, we're stuck
|
---|
46 | if "%JARPATH%" == "" goto noJar
|
---|
47 |
|
---|
48 | set JARPATH=%JARPATH%\bin
|
---|
49 | goto testJar
|
---|
50 |
|
---|
51 | :javahome
|
---|
52 | set JARPATH=%JAVA_HOME%\bin
|
---|
53 |
|
---|
54 | :testJar
|
---|
55 | :: Check that a jar executable has been found
|
---|
56 | if "%GLILANG%" == "en" echo Checking jar: %JARPATH%
|
---|
57 | if "%GLILANG%" == "es" echo Revisando jar: %JARPATH%
|
---|
58 | if "%GLILANG%" == "fr" echo Vrification de jar: %JARPATH%
|
---|
59 | if "%GLILANG%" == "ru" echo ஢¥àª jar: %JARPATH%
|
---|
60 | if exist "%JARPATH%\jar.exe" goto checkCompile
|
---|
61 |
|
---|
62 | :noJar
|
---|
63 | echo.
|
---|
64 | if "%GLILANG%" == "en" echo Failed to locate an appropriate version of jar. You must install a
|
---|
65 | if "%GLILANG%" == "en" echo Java Development Kit (version 1.4 or greater) before compiling the
|
---|
66 | if "%GLILANG%" == "en" echo Greenstone Librarian Interface.
|
---|
67 |
|
---|
68 | if "%GLILANG%" == "es" echo No se pudo localizar una versi¢n apropiada de jar. Usted deber
|
---|
69 | if "%GLILANG%" == "es" echo instalar un Kit de Desarrollo de Software Java (versi¢n 1.4 o superior)
|
---|
70 | if "%GLILANG%" == "es" echo antes de generar la documentaci¢n para la Interfaz de la Biblioteca
|
---|
71 | if "%GLILANG%" == "es" echo Digital Greenstone.
|
---|
72 |
|
---|
73 | if "%GLILANG%" == "fr" echo Une version approprie de jar n'a pas pu tre localise. Vous devez
|
---|
74 | if "%GLILANG%" == "fr" echo installer un Kit de Dveloppement Java (version 1.4 ou suprieure)
|
---|
75 | if "%GLILANG%" == "fr" echo avant de produire la documentation de Greenstone Librarian Interface.
|
---|
76 |
|
---|
77 | if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥á⮠宊€¥š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš jar.
|
---|
78 | if "%GLILANG%" == "ru" echo ë €®«Šë šáâ ««šà®¢ âì Java Development Kit (¢¥àášï 1.4 š«š ¢ëè¥)
|
---|
79 | if "%GLILANG%" == "ru" echo ¯à¥Š€¥, 祬 £¥¥àšà®¢ âì €®ªã¬¥â æšî €«ï ¡š¡«š®â¥ç®£®
|
---|
80 | if "%GLILANG%" == "ru" echo šâ¥à䥩á Greenstone.
|
---|
81 | goto exit
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 | :checkCompile
|
---|
86 | :: Check that the GLI has been compiled
|
---|
87 | if exist classes\org\greenstone\gatherer\GathererProg.class goto makeJar
|
---|
88 | if "%GLILANG%" == "es" (
|
---|
89 | echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
|
---|
90 | echo (por medio de makegli.sh) antes de ejecutar este guión.
|
---|
91 | )
|
---|
92 | if "%GLILANG%" == "fr" (
|
---|
93 | echo Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)
|
---|
94 | echo avant d'exécuter ce script.
|
---|
95 | )
|
---|
96 | if "%GLILANG%" == "ru" (
|
---|
97 | echo ÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone
|
---|
98 | echo (ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ
|
---|
99 | )
|
---|
100 | if "%GLILANG%" == "en" (
|
---|
101 | echo You need to compile the Greenstone Librarian Interface (using makegli.sh)
|
---|
102 | echo before running this script.
|
---|
103 | )
|
---|
104 | goto exit
|
---|
105 | fi
|
---|
106 |
|
---|
107 |
|
---|
108 | :makeJar
|
---|
109 | :: All the GLI class files and supporting libraries are put into the "jar" directory
|
---|
110 |
|
---|
111 | echo Assuming that Java code is freshly compiled...
|
---|
112 |
|
---|
113 | if NOT exist jar (
|
---|
114 | mkdir jar
|
---|
115 |
|
---|
116 | cd lib
|
---|
117 | "%JARPATH%\jar" xf apache.jar com org
|
---|
118 | "%JARPATH%\jar" xf qfslib.jar de
|
---|
119 |
|
---|
120 | move com ..\jar\com >NUL
|
---|
121 | move de ..\jar\de >NUL
|
---|
122 | move org ..\jar\org >NUL
|
---|
123 |
|
---|
124 | cd ..
|
---|
125 | )
|
---|
126 |
|
---|
127 | :: Copy the latest version of the GLI classes into the jar directory
|
---|
128 | if exist jar\org\greenstone (
|
---|
129 | rmdir /q /s jar\org\greenstone
|
---|
130 | )
|
---|
131 | xcopy /i /e /q classes\org\greenstone jar\org\greenstone
|
---|
132 |
|
---|
133 | :: Some of the things to go into the JAR file are optional, and may not exist
|
---|
134 | set optional=
|
---|
135 | if exist collect.zip (
|
---|
136 | set optional=%optional% collect.zip
|
---|
137 | )
|
---|
138 |
|
---|
139 | :: Recreate the metadata.zip file (contains the GLI metadata directory)
|
---|
140 | if exist jar\org\greenstone (
|
---|
141 | del /f metadata.zip
|
---|
142 | )
|
---|
143 | winutil\zip.exe -r metadata.zip metadata >NUL
|
---|
144 |
|
---|
145 | :: Jar everything up
|
---|
146 | "%JARPATH%\jar" cf GLI.jar .java.policy metadata.zip %optional% help -C classes dictionary.properties -C classes dictionary_es.properties -C classes dictionary_fr.properties -C classes dictionary_ru.properties -C classes feedback.properties -C classes images -C classes xml -C jar com -C jar de -C jar org
|
---|
147 |
|
---|
148 | :: Tidy up
|
---|
149 | del /f metadata.zip
|
---|
150 |
|
---|
151 | :: Generate the GLIServer.jar file for remote building
|
---|
152 | "%JARPATH%\jar" cf GLIServer.jar -C classes org/greenstone/gatherer/remote
|
---|
153 |
|
---|
154 | :: ---- Make signed JAR file for the applet, if desired ----
|
---|
155 | if (%1) == (-sign) (
|
---|
156 |
|
---|
157 | if not exist appletstore (
|
---|
158 | "%JARPATH%\keytool" -genkey -alias privateKey -keystore appletstore -storepass greenstone
|
---|
159 | )
|
---|
160 |
|
---|
161 | if exist SignedGatherer.jar del /f SignedGatherer.jar
|
---|
162 | if exist appletpasswd (
|
---|
163 | echo Using jarsigner to make signed jar file ...
|
---|
164 | "%JARPATH%\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey < appletpasswd >NUL 2>NUL
|
---|
165 | echo ... done.
|
---|
166 | ) ELSE (
|
---|
167 | "%JARPATH%\jarsigner" -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey
|
---|
168 | )
|
---|
169 | echo Installing SignedGatherer in ..\bin\java
|
---|
170 | move SignedGatherer.jar ..\bin\java\SignedGatherer.jar
|
---|
171 | )
|
---|
172 | :exit
|
---|
173 |
|
---|
174 | popd
|
---|