livesetup.nsi
6.6 KB
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
var pdtname
var pdtbrand
var pdtcompany
!include "StrFunc.nsh"
# Declare used functions
${StrRep}
;--------------------------------
;Include Modern UI
!define PRODUCT_APP_PATH "Software\3mlive\client"
!define PRODUCT_NAME $pdtname
!define PRODUCT_VERSION "4.0.0"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\3mlive"
!include "MUI.nsh"
;--------------------------------
;General
;Name and file
RequestExecutionLevel admin /* RequestExecutionLevel REQUIRED! */
Name $pdtname
OutFile "livesetup.exe"
BrandingText $pdtbrand
;Default installation folder
;==================================
; get app_dir
;--------------------------------
;Interface Configuration
; MUI pre-defined const
!define MUI_ABORTWARNING
;modify icon
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
;modify left image
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
;modify Head image
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall.bmp"
;modify title
!define MUI_WELCOMEPAGE_TITLE "\r\n xuedianyun screensharing service V${PRODUCT_VERSION}"
;modify welcome page text.
!define MUI_WELCOMEPAGE_TEXT " xuedianyun screensharing service\r\n\r\n right:xuedianyun \r\n\r\n $_CLICK"
;modify completed page title
!define MUI_FINISHPAGE_TITLE "\r\n xuedianyun screensharing service has installed."
;!define MUI_HEADERIMAGE
;!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ; optional
;!define MUI_ABORTWARNING
;--------------------------------
;Pages
;Languages
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
; !insertmacro MUI_PAGE_LICENSE "License.txt"
; !insertmacro MUI_PAGE_COMPONENTS
; !insertmacro MUI_PAGE_DIRECTORY
; !insertmacro MUI_PAGE_LICENSE $(MUILicense)
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Reserve Files
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
Var /GLOBAL os_ver
Var /GLOBAL app_dir
SetShellVarContext current
Call GetWindowsVersion
Pop $R0
StrCpy $os_ver $R0
;MessageBox MB_OK $os_ver
StrCpy $app_dir "$PROGRAMFILES"
StrCmp $os_ver "Vista" 0 VISTANEXT
${StrRep} $app_dir $app_dir "Program Files" "ProgramData"
Goto +2
VISTANEXT:
StrCmp $os_ver "win7" 0 WIN7NEXT
${StrRep} $app_dir $app_dir "Program Files" "ProgramData"
Goto +2
WIN7NEXT:
StrCmp $os_ver "win8" 0 WIN8NEXT
${StrRep} $app_dir $app_dir "Program Files" "ProgramData"
Goto +2
WIN8NEXT:
CreateDirectory $app_dir\"3mlive\"
SetOutPath $app_dir\"3mlive\"
ExecWait '$app_dir\3mlive\livemgr.exe -uninstall'
ExecWait '$app_dir\3mlive\audio_unreg.bat'
ExecWait '$app_dir\3mlive\audio_unreg64.bat'
;ADD YOUR OWN FILES HERE...
File .\files\*.*
;Create uninstaller
WriteUninstaller $app_dir\"3mlive\Uninstall.exe"
ExecWait '$app_dir\3mlive\audio_reg.bat'
ExecWait '$app_dir\3mlive\audio_reg64.bat'
ExecWait '$app_dir\3mlive\livemgr.exe -install'
WriteRegStr HKCU "${PRODUCT_APP_PATH}" "app_data_path" "$app_dir\3mlive\"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" "$app_dir\3mlive\uninstall.exe"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "DisplayVersion" "3mlive"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "www.3mang.com"
WriteRegStr HKLM "${PRODUCT_UNINST_KEY}" "Publisher" "3mlive"
;Create shortcuts
CreateDirectory "$SMPROGRAMS\3mlive"
CreateShortCut "$SMPROGRAMS\3mlive\Uninstall.lnk" "$app_dir\3mlive\Uninstall.exe"
SectionEnd
Function .onInit
FunctionEnd
Function un.onInit
FunctionEnd
Function GetWindowsVersion
Push $R0
Push $R1
ClearErrors
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors 0 lbl_winnt
; we are not NT
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
StrCpy $R1 $R0 1
StrCmp $R1 '4' 0 lbl_error
StrCpy $R1 $R0 3
StrCmp $R1 '4.0' lbl_win32_95
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
lbl_win32_95:
StrCpy $R0 '95'
Goto lbl_done
lbl_win32_98:
StrCpy $R0 '98'
Goto lbl_done
lbl_win32_ME:
StrCpy $R0 'ME'
Goto lbl_done
lbl_winnt:
StrCpy $R1 $R0 1
StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x
StrCpy $R1 $R0 3
StrCmp $R1 '5.0' lbl_winnt_2000
StrCmp $R1 '5.1' lbl_winnt_XP
StrCmp $R1 '5.2' lbl_winnt_2003
StrCmp $R1 '6.1' lbl_win7
StrCmp $R1 '6.2' lbl_win8
StrCmp $R1 '6.3' lbl_win81
StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
lbl_winnt_x:
StrCpy $R0 "NT $R0" 6
Goto lbl_done
lbl_winnt_2000:
StrCpy $R0 '2000'
Goto lbl_done
lbl_winnt_XP:
StrCpy $R0 'XP'
Goto lbl_done
lbl_winnt_2003:
StrCpy $R0 '2003'
Goto lbl_done
lbl_win7:
StrCpy $R0 'win7'
Goto lbl_done
lbl_win8:
StrCpy $R0 'win8'
Goto lbl_done
lbl_win81:
StrCpy $R0 'win8'
Goto lbl_done
lbl_winnt_vista:
StrCpy $R0 'Vista'
Goto lbl_done
lbl_error:
StrCpy $R0 ''
lbl_done:
Pop $R1
Exch $R0
FunctionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
RMDir /r $INSTDIR
Delete $INSTDIR\Uninstall.exe
Delete "$SMPROGRAMS\3mlive\Uninstall.lnk"
RMDir "$SMPROGRAMS\3mlive"
DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}"
SectionEnd