-
Notifications
You must be signed in to change notification settings - Fork 46
/
mDesktopSetup.nsi
237 lines (160 loc) · 5.87 KB
/
mDesktopSetup.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
RequestExecutionLevel admin
!define OC_STR_MY_PRODUCT_NAME "mDesktop"
; Please change the key and secret to the ones assigned for your specific products
!define OC_STR_KEY "116ead0e399c7d35ed65678adf799f35"
!define OC_STR_SECRET "f13ef28c9a737620ffc7a71135970822"
; Optionally change the path to OCSetupHlp.dll here if it's not in the same folder
; as your .nsi file. You must specify the relative path from your .nsi file location.
!define OC_OCSETUPHLP_FILE_PATH ".\OCSetupHlp.dll"
!define OC_LOADING_SCREEN_CAPTION " "
!define OC_LOADING_SCREEN_DESCRIPTION " "
!define OC_LOADING_SCREEN_MESSAGE "Loading..."
!define OC_LOADING_SCREEN_FONTFACE "Arial"
!define OC_LOADING_SCREEN_FONTSIZE 100
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "mDesktop"
OutFile "mDesktopSetup1.7.2.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\mDesktop"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\mDesktop" ""
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\mDesktop"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "mDesktop"
; !include "OCSetupHlp.nsh"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
; !insertmacro OpenCandyLoadingPage
; !insertmacro OpenCandyOfferPage
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
;Section "-OpenCandyEmbedded"
; Handle any offers the user accepted
;!insertmacro OpenCandyInstallEmbedded
;SectionEnd
Section "Main" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
File "mDesktop.exe"
SetOutPath "$INSTDIR\icons"
File "icons\1o.ico"
File "icons\2o.ico"
File "icons\3o.ico"
File "icons\4o.ico"
File "icons\1.ico"
File "icons\2.ico"
File "icons\3.ico"
File "icons\4.ico"
File "icons\5.ico"
File "icons\6.ico"
File "icons\7.ico"
File "icons\8.ico"
File "icons\9.ico"
File "icons\10.ico"
;Store installation folder
WriteRegStr HKCU "Software\mDesktop" "" $INSTDIR
WriteRegStr HKCU "Software\mDesktop" "version" "1.7.2"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\mDesktop.lnk" "$INSTDIR\mDesktop.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "The main binary."
LangString DESC_SecStartup ${LANG_ENGLISH} "Run on startup"
;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"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\mDesktop.exe"
Delete "$INSTDIR\icons\1.ico"
Delete "$INSTDIR\icons\2.ico"
Delete "$INSTDIR\icons\3.ico"
Delete "$INSTDIR\icons\4.ico"
Delete "$INSTDIR\icons\5.ico"
Delete "$INSTDIR\icons\6.ico"
Delete "$INSTDIR\icons\7.ico"
Delete "$INSTDIR\icons\8.ico"
Delete "$INSTDIR\icons\9.ico"
Delete "$INSTDIR\icons\10.ico"
Delete "$INSTDIR\icons\1o.ico"
Delete "$INSTDIR\icons\2o.ico"
Delete "$INSTDIR\icons\3o.ico"
Delete "$INSTDIR\icons\4o.ico"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR\icons"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\mDesktop.lnk"
Delete "$SMPROGRAMS\Startup\mDesktop.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\mDesktop"
SectionEnd
Function .onInit
# [OpenCandy]
; Initialize OpenCandy, check for offers
;
; Note: If you use a language selection system,
; e.g. MUI_LANGDLL_DISPLAY or calls to LangDLL, you must insert
; this macro after the language selection code in order for
; OpenCandy to detect the user-selected language.
; !insertmacro OpenCandyAsyncInit "${OC_STR_MY_PRODUCT_NAME}" "${OC_STR_KEY}" "${OC_STR_SECRET}" ${OC_INIT_MODE_NORMAL} ${OC_INIT_PERFORM_NOW}
# [/OpenCandy]
FunctionEnd
Function .onInstSuccess
# [OpenCandy]
; Signal successful installation, download and install accepted offers
;!insertmacro OpenCandyOnInstSuccess
# [/OpenCandy]
FunctionEnd
Function .onGUIEnd
# [OpenCandy]
; Inform the OpenCandy API that the installer is about to exit
; !insertmacro OpenCandyOnGuiEnd
# [/OpenCandy]
FunctionEnd
# [OpenCandy]
; Have the compiler perform some basic OpenCandy API implementation checks
;!insertmacro OpenCandyAPIDoChecks
# [/OpenCandy