-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyaflight.nsi
222 lines (196 loc) · 8.64 KB
/
yaflight.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
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "YaFlight"
!define PRODUCT_VERSION "1.0.3"
!define PRODUCT_PUBLISHER "YaFlight"
!define PRODUCT_WEB_SITE "http://yaflight.grysol.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\yaflight.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
SetCompressor lzma
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "C:\Users\matteo\workspace\yaflight\icons\yaflight-logo2013-32px.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
; License page
!insertmacro MUI_PAGE_LICENSE "PRE_INSTALL_INFO.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\yaflight.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.md"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Italian"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "setup-${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\YaFlight"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
; --------------- uninstall previous ----------------------
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller done
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
; --------------- uninstall previous end ----------------------
FunctionEnd
Section "SezionePrincipale" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "C:\Users\Matteo\workspace\build-yaflight-Desktop_Qt_5_3_0_MinGW_32bit-Release\release\yaflight.exe"
;File "C:\Users\matteo\workspace\yainstall-build\yainstall.exe"
CreateDirectory "$SMPROGRAMS\YaFlight"
CreateShortCut "$SMPROGRAMS\YaFlight\YaFlight.lnk" "$INSTDIR\yaflight.exe"
;CreateShortCut "$SMPROGRAMS\YaFlight\YaInstall.lnk" "$INSTDIR\yainstall.exe"
CreateShortCut "$DESKTOP\YaFlight.lnk" "$INSTDIR\yaflight.exe"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\icudt52.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\icuin52.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\icuuc52.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\libgcc_s_dw2-1.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\libstdc++-6.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\libwinpthread-1.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Core.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Gui.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Multimedia.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5MultimediaWidgets.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Network.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5OpenGL.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5PrintSupport.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Qml.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Quick.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Sensors.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Sql.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5WebKit.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5WebKitWidgets.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Widgets.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Xml.dll"
File "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\Qt5Positioning.dll"
File "C:\Users\Matteo\workspace\zlib-win-build\build-VS2019\Release\libz.dll"
SetOverwrite try
CreateDirectory "$OUTDIR\languages"
File /r "C:\Qt\Qt5.3.0\5.3\mingw482_32\plugins\iconengines"
File /r "C:\Qt\Qt5.3.0\5.3\mingw482_32\plugins\imageformats"
File /r "C:\Qt\Qt5.3.0\5.3\mingw482_32\plugins\platforms"
File /oname=$OUTDIR\languages\it_IT.qm "C:\Users\matteo\workspace\yaflight\languages\it_IT.qm"
File /oname=$OUTDIR\languages\fr_FR.qm "C:\Users\matteo\workspace\yaflight\languages\fr_FR.qm"
File /oname=$OUTDIR\languages\cs_CZ.qm "C:\Users\matteo\workspace\yaflight\languages\cs_CZ.qm"
File /oname=$OUTDIR\languages\de_DE.qm "C:\Users\matteo\workspace\yaflight\languages\de_DE.qm"
File /oname=$OUTDIR\languages\es_ES.qm "C:\Users\matteo\workspace\yaflight\languages\es_ES.qm"
File /r "C:\Users\matteo\workspace\yaflight\themes"
SetOverwrite ifnewer
File "C:\Users\matteo\workspace\yalib-build\src\libyalib.dll"
File /oname=$OUTDIR\README.txt "C:\Users\matteo\workspace\yaflight\README.md"
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\YaFlight\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\YaFlight\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\yaflight.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}" "DisplayIcon" "$INSTDIR\yaflight.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) è stato completamente rimosso dal tuo computer."
FunctionEnd
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Sei sicuro di voler completamente rimuovere $(^Name) e tutti i suoi componenti?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\libyalib.dll"
Delete "$INSTDIR\languages\*.qm"
Delete "$INSTDIR\themes\*.qss"
Delete "$INSTDIR\imageformats\*.*"
Delete "$INSTDIR\platforms\*.*"
Delete "$INSTDIR\iconengines\*.*"
RMDir "$INSTDIR\languages"
RMDir "$INSTDIR\themes"
RMDir "$INSTDIR\imageformats"
RMDir "$INSTDIR\iconengines"
RMDir "$INSTDIR\platforms"
Delete "$INSTDIR\icudt52.dll"
Delete "$INSTDIR\icuin52.dll"
Delete "$INSTDIR\icuuc52.dll"
Delete "$INSTDIR\libgcc_s_dw2-1.dll"
Delete "$INSTDIR\libstdc++-6.dll"
Delete "$INSTDIR\libwinpthread-1.dll"
Delete "$INSTDIR\Qt5Core.dll"
Delete "$INSTDIR\Qt5Gui.dll"
Delete "$INSTDIR\Qt5Multimedia.dll"
Delete "$INSTDIR\Qt5MultimediaWidgets.dll"
Delete "$INSTDIR\Qt5Network.dll"
Delete "$INSTDIR\Qt5OpenGL.dll"
Delete "$INSTDIR\Qt5PrintSupport.dll"
Delete "$INSTDIR\Qt5Qml.dll"
Delete "$INSTDIR\Qt5Quick.dll"
Delete "$INSTDIR\Qt5Sensors.dll"
Delete "$INSTDIR\Qt5Sql.dll"
Delete "$INSTDIR\Qt5WebKit.dll"
Delete "$INSTDIR\Qt5WebKitWidgets.dll"
Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\Qt5Xml.dll"
Delete "$INSTDIR\Qt5Positioning.dll"
Delete "$INSTDIR\libz.dll"
Delete "$INSTDIR\libzlib.dll"
;Delete "$INSTDIR\libzip.dll"
Delete "$INSTDIR\yaflight.exe"
;Delete "$INSTDIR\yainstall.exe"
Delete "$SMPROGRAMS\YaFlight\Uninstall.lnk"
Delete "$SMPROGRAMS\YaFlight\Website.lnk"
Delete "$DESKTOP\YaFlight.lnk"
Delete "$SMPROGRAMS\YaFlight\YaFlight.lnk"
RMDir "$SMPROGRAMS\YaFlight"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd