ludc
2025-01-09 cf7a633427e1d7cf2ad481a8882408ca5d493a8d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
@echo off
cls
color 0a
echo ***************************************************************************
echo.*                                                                         *
echo.*                ±±¾©ºê²©Ô¶´ïJARÎļþÅúÁ¿Ç©Ãû³ÌÐò                          *
echo.*                                                                         *
echo.*                                                                         *
echo.*                   Http://www.vci-tech.com                               *
echo.*                                                                         *
echo ***************************************************************************
rem ½øÈëµ½ÏîÄ¿Ö÷Ŀ¼µÄjreĿ¼£¨¸ÃĿ¼µÄÄÚÈÝʵ¼ÊÊÇJDK°²×°ºóµÄÈ«²¿ÄÚÈÝ£¬ÆäÒ²°üº¬jre£©
cd ../../jre/bin
rem ÉèÖù¤¾ßÎļþµÄ»·¾³±äÁ¿ 
rem ÓÉÓÚ%CD%µÃµ½µÄÖµ£¨Â·¾¶£©×îºóÃæ²»°üº¬'\'£¬
set TOOL_HOME=%CD%
cd ../../
rem ÏîÄ¿ËùÔÚ·¾¶
set PROJECT_HOME=%CD%
rem echo. %%PROJECT_HOME%% %PROJECT_HOME%
rem ÖØÐ»ص½Ç©Ãû³ÌÐòËùÔÚµÄĿ¼
cd _SIGNER
set _SIGNER=%CD%
 
set key=vcivci
set keyFile=%_SIGNER%\vcikeystore
set alias=vci
 
set APP_HOME=%PROJECT_HOME%
set LOGS_PATH=%APP_HOME%\logs
set SIGN_LOG=%LOGS_PATH%\sign_log.txt
 
rem WEB Ä£¿é Ãû³Æ 
set WEB_APP_NAME=web
 
set libs_home=%PROJECT_HOME%\libs
set libs_base=%libs_home%\base
set libs_modules=%libs_home%\modules
set libs_projects=%libs_home%\projects
 
set WEB_INF_HOME=%PROJECT_HOME%\WEB-INF
set WEB_INF_lib=%WEB_INF_HOME%\lib
 
set folder_lib_signed=%_SIGNER%\folder-lib-signed
set folder_lib_signed_base=%folder_lib_signed%\base
set folder_lib_signed_modules=%folder_lib_signed%\modules
set folder_lib_signed_projects=%folder_lib_signed%\projects
 
set folder_lib_signed_signed=%folder_lib_signed%\_signed
set folder_lib_signed_signed_base=%folder_lib_signed_signed%\base
set folder_lib_signed_signed_modules=%folder_lib_signed_signed%\modules
set folder_lib_signed_signed_projects=%folder_lib_signed_signed%\projects
 
set tomcat_home=%PROJECT_HOME%\tomcat
set tomcat_webapps=%tomcat_home%\webapps
set tomcat_webapps_xxx=%tomcat_webapps%\%WEB_APP_NAME%
set tomcat_webapps_xxx_WEB_INF=%tomcat_webapps_xxx%\WEB-INF
set tomcat_webapps_xxx_WEB_INF_lib=%tomcat_webapps_xxx_WEB_INF%\lib
 
set conf_properties_name=conf.properties
set conf_properties_relative_path=properties\%conf_properties_name%
set conf_properties_full_path=%_SIGNER%\%conf_properties_relative_path%
set rmip_system_common_jar_name=rmip-system-common.jar
set need_signed_rmip_system_common_full_path=%folder_lib_signed_signed_base%\%rmip_system_common_jar_name%
 
echo.
echo ***************************************************************************
echo.*                Ïà¹Ø»·¾³±äÁ¿¼°²ÎÊýÐÅÏ¢                                   *
echo.*                                                                         *
echo.%%PROJECT_HOME%%                =%PROJECT_HOME%
echo.%%APP_HOME%%                =%APP_HOME%
echo.%%TOOL_HOME%%                =%TOOL_HOME%
echo.%%_SIGNER%%                =%_SIGNER%
echo.%%keyFile%%                =%keyFile%
 
echo.%%WEB_INF_HOME%%                =%WEB_INF_HOME%
echo.%%WEB_INF_lib%%                =%WEB_INF_lib%
echo.%%folder_lib_signed%%            =%folder_lib_signed%
echo.%%folder_lib_signed_base%%            =%folder_lib_signed_base%
echo.%%folder_lib_signed_modules%%        =%folder_lib_signed_modules%
echo.%%folder_lib_signed_projects%%        =%folder_lib_signed_projects%
 
echo.%%folder_lib_signed_signed%%        =%folder_lib_signed_signed%
echo.%%folder_lib_signed_signed_base%%        =%folder_lib_signed_signed_base%
echo.%%folder_lib_signed_signed_modules%%    =%folder_lib_signed_signed_modules%
echo.%%folder_lib_signed_signed_projects%%    =%folder_lib_signed_signed_projects%
 
echo.%%tomcat_home%%                =%tomcat_home%
echo.%%tomcat_webapps%%            =%tomcat_webapps%
echo.%%tomcat_webapps_xxx%%            =%tomcat_webapps_xxx%
echo.%%tomcat_webapps_xxx_WEB_INF%%        =%tomcat_webapps_xxx_WEB_INF%
echo.%%tomcat_webapps_xxx_WEB_INF_lib%%    =%tomcat_webapps_xxx_WEB_INF_lib%
echo.*                                                                         *
echo.*                                                                         *
echo ***************************************************************************
echo.
 
if not exist %libs_home% (
    md %libs_home% >NUL 2>&1
    md %libs_base% >NUL 2>&1
    md %libs_modules% >NUL 2>&1
    md %libs_projects% >NUL 2>&1
) else (
    if not exist %libs_base% (
        md %libs_base% >NUL 2>&1
    )
    if not exist %libs_modules% (
        md %libs_modules% >NUL 2>&1
    )
    if not exist %libs_projects% (
        md %libs_projects% >NUL 2>&1
    )
)
if not exist %WEB_INF_HOME% (
    md %WEB_INF_HOME% >NUL 2>&1
    md %WEB_INF_lib% >NUL 2>&1
) else (
    if not exist %WEB_INF_lib% (
        md %WEB_INF_lib% >NUL 2>&1
    )
)
 
echo.1¡¢É¾³ýÒѾ­´æÔÚµÄÃÜÔ¿Îļþ
rem del %keyFile%
echo.1¡¢É¾³ýÒѾ­´æÔÚµÄÃÜÔ¿Îļþ¡¾Íê³É¡¿
echo.
 
echo.2¡¢ÖØÐÂÉú³ÉÃÜÔ¿Îļþ
rem call %TOOL_HOME%keytool -genkey -keystore %keyFile% -alias %alias% -dname "CN=VCI Technology Co.Ltd,OU=vci-tech.com,O=bj,L=bj,ST=bj,C=cn" -keypass %key% -storepass %key%  -validity 7200
echo.2¡¢ÖØÐÂÉú³ÉÃÜÔ¿Îļþ¡¾Íê³É¡¿
echo.
goto there_copy_lib_to_signed
 
:there_copy_lib_to_signed
echo.
rem ÏÈɾ³ýĿ¼£¬ÔÙ´´½¨
rd /S /Q %folder_lib_signed_signed% >NUL 2>&1
md %folder_lib_signed_signed% >NUL 2>&1
if exist %folder_lib_signed_base% (
echo.3¡¢½« %folder_lib_signed_base% ×ªÒƵ½´ýÇ©ÃûĿ¼£¨%folder_lib_signed_signed%£©
xcopy %folder_lib_signed_base%  %folder_lib_signed_signed_base%\  /S /E /Y  >NUL 2>&1
echo.3¡¢½« %folder_lib_signed_base% ×ªÒƵ½´ýÇ©ÃûĿ¼£¨%folder_lib_signed_signed%£©¡¾Íê³É¡¿
echo.
echo.
goto there_copy_modules_to_signed
)
echo.
echo.
goto there_copy_modules_to_signed
 
:there_copy_modules_to_signed
if exist %folder_lib_signed_modules% (
echo.3.1¡¢½« %folder_lib_signed_modules% ×ªÒƵ½´ýÇ©ÃûĿ¼£¨%folder_lib_signed_signed%£©
xcopy %folder_lib_signed_modules%  %folder_lib_signed_signed_modules%\  /S /E /Y  >NUL 2>&1
echo.3.1¡¢½« %folder_lib_signed_modules% ×ªÒƵ½´ýÇ©ÃûĿ¼£¨%folder_lib_signed_signed%£©¡¾Íê³É¡¿
echo.
echo.
goto there_copy_projects_to_signed
)
echo.
echo.
goto there_copy_projects_to_signed
 
:there_copy_projects_to_signed
if exist %folder_lib_signed_projects% (
echo.3.1¡¢½« %folder_lib_signed_projects% ×ªÒƵ½´ýÇ©ÃûĿ¼£¨%folder_lib_signed_signed%£©
xcopy %folder_lib_signed_projects%  %folder_lib_signed_signed_projects%\  /S /E /Y  >NUL 2>&1
echo.3.1¡¢½« %folder_lib_signed_projects% ×ªÒƵ½´ýÇ©ÃûĿ¼£¨%folder_lib_signed_signed%£©¡¾Íê³É¡¿
echo.
echo.
goto there_copy_done
)
echo.
echo.
goto there_copy_done
 
:there_copy_done
if  exist %conf_properties_full_path% goto four_conf_process
goto six_batch_signer
 
:four_conf_process
if exist %need_signed_rmip_system_common_full_path% goto four_write_conf_to_jar
goto five_replace_conf
 
:four_write_conf_to_jar
echo.4¡¢Ð´ÈëÅäÖÃÎļþµ½ %rmip_system_common_jar_name% (½« %conf_properties_full_path% ÖØÐÂдÈëµ½ %need_signed_rmip_system_common_full_path%£©
rem ½« _SIGNER\properties\conf.properties ÖØÐÂдÈëµ½ ´ýÇ©ÃûµÄ _signed\lib\rmip-system-common.jar
%TOOL_HOME%\jar -uvf %need_signed_rmip_system_common_full_path% %conf_properties_relative_path%
echo.4¡¢Ð´ÈëÅäÖÃÎļþµ½ %rmip_system_common_jar_name% (½« %conf_properties_full_path% ÖØÐÂдÈëµ½ %need_signed_rmip_system_common_full_path%£©¡¾Íê³É¡¿
echo.
goto five_replace_conf
 
:five_replace_conf
echo.5¡¢Ìæ»»ÅäÖÃÎļþ£¨½«%conf_properties_full_path% ¸´ÖƵ½ %PROJECT_HOME%\properties£©
rem ½« _SIGNER\properties\conf.properties ÖØÐ¸´ÖƵ½ ÏîÄ¿·¢²¼¸ùĿ¼ %PROJECT_HOME%\properties£©¡¾Íê³É¡¿
copy /Y %conf_properties_full_path% %PROJECT_HOME%\properties\conf.properties >NUL 2>&1
rem echo.   copy %conf_properties_full_path% to %PROJECT_HOME%\properties\conf.properties [OK]
echo.5¡¢Ìæ»»ÅäÖÃÎļþ£¨½«%conf_properties_full_path% ¸´ÖƵ½ %PROJECT_HOME%\properties£©¡¾Íê³É¡¿
echo.
goto six_batch_signer
 
:six_batch_signer
set sign_count=0
echo.6¡¢ÅúÁ¿Ç©Ãû£¨¶Ô %folder_lib_signed_signed% Ï£¨°üº¬×ÓÎļþ¼ÐÀȫ²¿µÄ.jar ½øÐÐÇ©Ãû£©
rem Ñ­»·ÅúÁ¿¶Ô _SIGNER\folder-lib-signed\_signed\**\*.jar ½øÐÐÇ©Ãû
for /r %folder_lib_signed_signed% %%f in (*.jar) do (
    %TOOL_HOME%\jarsigner -storepass %key% -keystore %keyFile% %%f %alias%  
    set /a sign_count+=1
    echo.   Ç©Ãû %%f [OK]
)
echo.   Ç©ÃûÁË %sign_count% ¸öÎļþ
echo.6¡¢ÅúÁ¿Ç©Ãû£¨¶Ô %folder_lib_signed_signed% Ï£¨°üº¬×ÓÎļþ¼ÐÀȫ²¿µÄ.jar ½øÐÐÇ©Ãû£©¡¾Íê³É¡¿
echo.
if exist %folder_lib_signed_signed_base% goto copy_signed_lib_jar_to_libs_base
goto copy_signed_lib_jar_to_libs_base_not
 
:copy_signed_lib_jar_to_libs_base
set copy_count=0
echo.7¡¢½«ÒѾ­Ç©ÃûºóµÄ %folder_lib_signed_signed_base%\*.jar ¸´ÖƵ½ %libs_base% Ä¿Â¼ÏÂ
rem ½«Ç©ÃûºóµÄ %PROJECT_HOME%\_SIGNER\folder-lib-signed\_signed\base ¿½±´µ½ ÏîÄ¿·¢²¼¸ùĿ¼ libs\base
for /r %folder_lib_signed_signed_base% %%f in (*.jar) do (
    copy /Y %%f %libs_base% >NUL 2>&1
    set /a copy_count+=1
    rem echo.   copy %%f to %libs_lib% [OK]
)
echo.   ¸´ÖÆÁË %copy_count% ¸öÎļþ
 
:copy_signed_lib_jar_to_libs_base_not
if exist %folder_lib_signed_signed_modules% goto copy_signed_modules_jar_to_libs_modules
goto copy_signed_modules_jar_to_libs_modules_not
 
:copy_signed_modules_jar_to_libs_modules
echo.8¡¢½«ÒÑÇ©Ãûºó %folder_lib_signed_signed_modules%\**\*.jar ¸´ÖƵ½ %libs_modules% Ä¿Â¼ÏÂ
rem ½«Ç©ÃûºóµÄ %PROJECT_HOME%\_SIGNER\folder-lib-signed\_signed\modules\**\*.jar ¿½±´µ½ ÏîÄ¿·¢²¼¸ùĿ¼ libs\modules
xcopy %folder_lib_signed_signed_modules%  %libs_modules%\  /S /E /Y  >NUL 2>&1
echo.8¡¢½«ÒÑÇ©Ãûºó %folder_lib_signed_signed_modules%\**\*.jar ¸´ÖƵ½ %libs_modules% Ä¿Â¼Ï¡¾Íê³É¡¿
echo.
 
:copy_signed_modules_jar_to_libs_modules_not
if exist %folder_lib_signed_signed_projects% goto copy_signed_modules_jar_to_libs_projects
goto eof
 
:copy_signed_modules_jar_to_libs_projects
echo.9¡¢½«ÒÑÇ©Ãûºó %folder_lib_signed_signed_projects%\**\*.jar ¸´ÖƵ½ %libs_modules% Ä¿Â¼ÏÂ
rem ½«Ç©ÃûºóµÄ %PROJECT_HOME%\_SIGNER\folder-lib-signed\_signed\modules\**\*.jar ¿½±´µ½ ÏîÄ¿·¢²¼¸ùĿ¼ libs\modules
xcopy %folder_lib_signed_signed_projects%  %libs_projects%\  /S /E /Y  >NUL 2>&1
echo.9¡¢½«ÒÑÇ©Ãûºó %folder_lib_signed_signed_projects%\**\*.jar ¸´ÖƵ½ %libs_modules% Ä¿Â¼Ï¡¾Íê³É¡¿
echo.
 
 
:eof
echo.
echo.10¡¢È«²¿Íê³É
echo.
echo.
 
pause