-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwutau.nsi
293 lines (250 loc) · 11.1 KB
/
wutau.nsi
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "WuTaoWebSetup"
!define PRODUCT_VERSION "1.2"
!define PRODUCT_PUBLISHER "EASYCHAIN TECHNOLOGY CO.,LTD"
!define PRODUCT_WEB_SITE "http://www.easychain.com.tw"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
SetCompressor bzip2
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
; MUI Settings
!define MUI_ABORTWARNING
;!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\wutao.ico"
!define MUI_ICON "wwwroot\wutao.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
; 第一步 歡迎頁面Welcome page
!insertmacro MUI_PAGE_WELCOME
; 第二步 選取安裝路徑 Directory page
;!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
;!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
; NET 變數 start-------
!define NETVersion "3.5"
!define NETInstaller "dotNetFx35setup.exe"
!define NET4 "4.0.30319"
!define NET4Installer "NDP451-x86-x64-ENU.exe"
!define NET4_5Installer "dotNetFx45_Full_setup.exe"
; NET 變數 end-------
;CrystalReport 變數 Start ------------------
;!define CRInstaller "CRRuntime_32bit_13_0_13.msi"
;CrystalReport 變數 End ------------------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}_${PRODUCT_VERSION}.exe"
InstallDir "C:\inetpub\wwwroot"
ShowInstDetails hide
;show
ShowUnInstDetails hide
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
Call CheckIISVersion
FunctionEnd
;判斷.NET Framework 安裝
Section "MS .NET Framework v${NET4}" SecNETFramework4
IfFileExists "$WINDIR\Microsoft.NET\Framework\v${NET4}" NETFrameworkInstalled 0
File /oname=$TEMP\${NET4Installer} ${NET4Installer}
DetailPrint "Starting Microsoft .NET Framework v${NET4} Setup..."
ExecWait "$TEMP\${NET4Installer}"
Return
NETFrameworkInstalled:
;MessageBox MB_ICONSTOP|MB_OK "Microsoft .NET Framework v${NET4} 已經安裝。" IDYES
DetailPrint "Microsoft .NET Framework is already installed!"
SectionEnd
/*Section "Crystal Report" SetCrystalReport
IfFileExists "$PROGRAMFILES32\SAP BusinessObjects" CrystalReportInstalled 0
File /oname=$TEMP\${CRInstaller} ${CRInstaller}
DetailPrint "Starting CrystalReport Setup..."
;ExecWait "$TEMP\${CRInstaller}"
ExecWait '"msiexec" /package "$TEMP\${CRInstaller}" /qf'
Return
CrystalReportInstalled:
DetailPrint "CrystalReport is already installed!"
SectionEnd*/
;設定wwwroot 基本資料
Section "wwwroot" wwwroot
SetOutPath "$INSTDIR"
File /r "UpdateList.txt"
SetOutPath "$INSTDIR\css"
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "wwwroot\css\*.*"
SetOutPath "$INSTDIR\EC2"
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "wwwroot\EC2\*.*"
SetOutPath "$INSTDIR\js"
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "wwwroot\js\*.*"
SetOutPath "$INSTDIR"
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "wwwroot\NoRight.htm"
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "wwwroot\wutauconfig_Crypto.config"
Rename "$INSTDIR\wutauconfig_Crypto.config" "$INSTDIR\wutauconfig.config"
SectionEnd
Section "WebApp1" WebApp1
CreateDirectory "$INSTDIR\WebApp1"
SetOutPath "$INSTDIR\WebApp1"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "WebApp1\*.*"
RMDir /r /REBOOTOK "$INSTDIR\WebApp1\obj"
RMDir /r /REBOOTOK "$INSTDIR\WebApp1\Log"
CreateDirectory "$INSTDIR\WebApp1\Log"
SectionEnd
Section "HR" HR
CreateDirectory "$INSTDIR\HR"
SetOutPath "$INSTDIR\HR"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "HR\*.*"
RMDir /r /REBOOTOK "$INSTDIR\HR\obj"
RMDir /r /REBOOTOK "$INSTDIR\HR\Log"
CreateDirectory "$INSTDIR\HR\Log"
RMDir /r /REBOOTOK "$INSTDIR\HR\docs"
CreateDirectory "$INSTDIR\HR\docs"
SectionEnd
Section "IM" IM
CreateDirectory "$INSTDIR\IM"
SetOutPath "$INSTDIR\IM"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "IM\*.*"
RMDir /r /REBOOTOK "$INSTDIR\IM\obj"
RMDir /r /REBOOTOK "$INSTDIR\IM\Log"
CreateDirectory "$INSTDIR\IM\Log"
SectionEnd
Section "LM" LM
CreateDirectory "$INSTDIR\LM"
SetOutPath "$INSTDIR\LM"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "LM\*.*"
RMDir /r /REBOOTOK "$INSTDIR\LM\obj"
RMDir /r /REBOOTOK "$INSTDIR\LM\Log"
CreateDirectory "$INSTDIR\LM\Log"
SectionEnd
Section "Picking" Picking
CreateDirectory "$INSTDIR\Picking"
SetOutPath "$INSTDIR\Picking"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "Picking\*.*"
RMDir /r /REBOOTOK "$INSTDIR\Picking\obj"
RMDir /r /REBOOTOK "$INSTDIR\Picking\Log"
CreateDirectory "$INSTDIR\Picking\Log"
SectionEnd
Section "SF" SF
CreateDirectory "$INSTDIR\SF"
SetOutPath "$INSTDIR\SF"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "SF\*.*"
RMDir /r /REBOOTOK "$INSTDIR\SF\obj"
RMDir /r /REBOOTOK "$INSTDIR\SF\Log"
CreateDirectory "$INSTDIR\SF\Log"
SectionEnd
Section "wutau" wutau
CreateDirectory "$INSTDIR\wutau"
SetOutPath "$INSTDIR\wutau"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "wutau\*.*"
RMDir /r /REBOOTOK "$INSTDIR\wutau\obj"
RMDir /r /REBOOTOK "$INSTDIR\wutau\Log"
CreateDirectory "$INSTDIR\wutau\Log"
SectionEnd
Section "Rpt" Rpt
CreateDirectory "$INSTDIR\Rpt"
SetOutPath "$INSTDIR\Rpt"
SetOverwrite try
File /r /x *.txt /x Log\* /x [obj] /x *.cs /x *.pdb /x *.resx /x *.csproj /x *.csproj.* /x *.pubxml /x *.pubxml.* "Rpt\*.*"
RMDir /r /REBOOTOK "$INSTDIR\Rpt\obj"
RMDir /r /REBOOTOK "$INSTDIR\Rpt\Log"
CreateDirectory "$INSTDIR\Rpt\Log"
SectionEnd
Section "設定AppPool" AppPool
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add apppool /name:wutau /managedRuntimeVersion:v4.0 /enable32BitAppOnWin64:true'
SectionEnd
Section "設定IIS" IIS
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/WebApp1 /physicalPath:$INSTDIR\WebApp1 /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/HR /physicalPath:$INSTDIR\HR /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/IM /physicalPath:$INSTDIR\IM /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/LM /physicalPath:$INSTDIR\LM /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/Picking /physicalPath:$INSTDIR\Picking /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/SF /physicalPath:$INSTDIR\SF /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/wutau /physicalPath:$INSTDIR\wutau /applicationPool:wutau'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/Rpt /physicalPath:$INSTDIR\Rpt /applicationPool:wutau'
;nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd set site /site.name:"Default Web Site" /application[path=''/''].virtualDirectory[path='/'].physicalPath:"$INSTDIR"'
;nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd set site /site.name:"Default Web Site" /[path=''/''].applicationPool:wutau'
; nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/Picking /physicalPath:$INSTDIR\Picking /applicationPool:wutau'
SetRebootFlag true
IfRebootFlag 0 +2
;MessageBox MB_OK "System Reboot Now!"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地從你的電腦移除。"
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你確定要完全移除 $(^Name) ,其及所有的元件?" IDYES +2
Abort
FunctionEnd
Section Uninstall
;刪除app
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/WebApp1"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/HR"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/IM"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/LM"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/Picking"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/SF"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/wutau"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete app "Default Web Site/Rpt"'
nsExec::ExecToLog '$SYSDIR\inetsrv\appcmd delete apppool "wutau"'
RMDir /r /REBOOTOK "$INSTDIR\HR"
RMDir /r /REBOOTOK "$INSTDIR\WebApp1"
RMDir /r /REBOOTOK "$INSTDIR\IM"
RMDir /r /REBOOTOK "$INSTDIR\LM"
RMDir /r /REBOOTOK "$INSTDIR\Picking"
RMDir /r /REBOOTOK "$INSTDIR\SF"
RMDir /r /REBOOTOK "$INSTDIR\wutau"
RMDir /r /REBOOTOK "$INSTDIR\Rpt"
RMDir /r /REBOOTOK "$INSTDIR\css"
RMDir /r /REBOOTOK "$INSTDIR\EC2"
RMDir /r /REBOOTOK "$INSTDIR\js"
Delete "$INSTDIR\NoRight.htm"
Delete "$INSTDIR\wutauconfig.config"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\UpdateList.txt"
SetAutoClose true
SectionEnd
Function CheckIISVersion
ClearErrors
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\InetStp" "MajorVersion"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\InetStp" "MinorVersion"
IfErrors 0 IISVersion
;有安裝iis
MessageBox MB_OK "沒有安裝IIS6或更高版本,?是必?安?的。安裝程序將中止。"
Abort
IISVersion: ;版本判斷
IntCmp $0 6 NoAbort IISMajVerLT6 NoAbort
NoAbort:
;MessageBox MB_OK "??到 Microsoft Internet 信息服?器版本 v$0.$1"
Goto ExitFunction
IISMajVerLT6:
MessageBox MB_OK "您目前安裝的IIS v$0.$1 版本低于要求版本 v6.0。安裝程序將中止。"
Abort
ExitFunction:
FunctionEnd