forked from Walkman100/BasicBrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSIS Installer for BasicBrowser.nsi
217 lines (175 loc) · 7.78 KB
/
NSIS Installer for BasicBrowser.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
; BasicBrowser Installer NSIS Script
; get NSIS at http://nsis.sourceforge.net/Download
!define ProgramName "BasicBrowser"
!define ProgramVersion 1.1.0.0
Icon "Resources\internet2.ico"
Name "${ProgramName}(Gecko)"
Caption "${ProgramName}(Gecko) Installer"
XPStyle on
Unicode true
ShowInstDetails show
AutoCloseWindow true
VIProductVersion ${ProgramVersion}
VIAddVersionKey "ProductVersion" "${ProgramVersion}"
VIAddVersionKey "ProductName" "${ProgramName}"
VIAddVersionKey "FileVersion" "${ProgramVersion}"
VIAddVersionKey "LegalCopyright" "FOSS Walkman"
VIAddVersionKey "FileDescription" "${ProgramName} Installer"
LicenseBkColor /windows
LicenseData "LICENSE.md"
LicenseForceSelection checkbox "I have read and understand this notice"
LicenseText "Please read the notice below before installing ${ProgramName}. If you understand the notice, click the checkbox below and click Next."
InstallDir $PROGRAMFILES\DeavmiOSS\${ProgramName}(Gecko)
OutFile "bin\Release\${ProgramName}-Installer.exe"
; Pages
Page license
Page components
Page directory
Page instfiles
Page custom postInstallShow postInstallFinish ": Install Complete"
UninstPage uninstConfirm
UninstPage instfiles
; Sections
Section "Executable, Uninstaller & DLLs"
SectionIn RO
SetOutPath $INSTDIR
File "bin\Release\${ProgramName}.exe"
WriteUninstaller "${ProgramName}(Gecko)-Uninst.exe"
; DLLs
File "bin\Release\*.dll"
; Sub-Folders
File /r "bin\Release\chrome"
File /r "bin\Release\components"
File /r "bin\Release\defaults"
File /r "bin\Release\dictionaries"
File /r "bin\Release\greprefs"
File /r "bin\Release\modules"
File /r "bin\Release\plugins"
File /r "bin\Release\res"
SectionEnd
Section "Add to Windows Programs & Features"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "DisplayName" "${ProgramName}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "Publisher" "WalkmanOSS"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "DisplayIcon" "$INSTDIR\${ProgramName}.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "InstallLocation" "$INSTDIR\"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "UninstallString" "$INSTDIR\${ProgramName}-Uninst.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "DisplayVersion" "${ProgramVersion}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "NoRepair" 1
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "HelpLink" "https://github.com/Walkman100/${ProgramName}/issues/new"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "URLInfoAbout" "https://github.com/Walkman100/${ProgramName}" ; Support Link
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" "URLUpdateInfo" "https://github.com/Walkman100/${ProgramName}/releases" ; Update Info Link
SectionEnd
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\DeavmiOSS"
CreateShortCut "$SMPROGRAMS\DeavmiOSS\${ProgramName}(Gecko).lnk" "$INSTDIR\${ProgramName}.exe" "" "$INSTDIR\${ProgramName}.exe" "" "" "" "${ProgramName}(Gecko)"
CreateShortCut "$SMPROGRAMS\DeavmiOSS\Uninstall ${ProgramName}(Gecko).lnk" "$INSTDIR\${ProgramName}(Gecko)-Uninst.exe" "" "" "" "" "" "Uninstall ${ProgramName}(Gecko)"
;Syntax for CreateShortCut: link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]
SectionEnd
Section "Desktop Shortcut"
CreateShortCut "$DESKTOP\${ProgramName}(Gecko).lnk" "$INSTDIR\${ProgramName}.exe" "" "$INSTDIR\${ProgramName}.exe" "" "" "" "${ProgramName}(Gecko)"
SectionEnd
Section "Quick Launch Shortcut"
CreateShortCut "$QUICKLAUNCH\${ProgramName}(Gecko).lnk" "$INSTDIR\${ProgramName}.exe" "" "$INSTDIR\${ProgramName}.exe" "" "" "" "${ProgramName}(Gecko)"
SectionEnd
SubSection "Open in ${ProgramName}(Gecko)"
Section "Add to Open With menu"
WriteRegStr HKCR "Applications\${ProgramName}(Gecko).exe\shell\open\command" "" "$\"$INSTDIR\${ProgramName}.exe$\" $\"%1$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\OpenWithList" "k" "${ProgramName}(Gecko).exe"
SectionEnd
Section "Set as default program"
WriteRegStr HKCR "Applications\${ProgramName}(Gecko).exe\shell\open\command" "" "$\"$INSTDIR\${ProgramName}.exe$\" $\"%1$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" "Progid" "Applications\${ProgramName}(Gecko).exe"
SectionEnd
SubSectionEnd
; Functions
Function .onInit
SetShellVarContext all
SetAutoClose true
FunctionEnd
; Custom Install Complete page
!include nsDialogs.nsh
!include LogicLib.nsh ; For ${IF} logic
Var Dialog
Var Label
Var CheckboxReadme
Var CheckboxReadme_State
Var CheckboxRunProgram
Var CheckboxRunProgram_State
Function postInstallShow
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Setup will launch these tasks when you click close:"
Pop $Label
${NSD_CreateCheckbox} 10u 30u 100% 10u "&Open Readme"
Pop $CheckboxReadme
${If} $CheckboxReadme_State == ${BST_CHECKED}
${NSD_Check} $CheckboxReadme
${EndIf}
${NSD_CreateCheckbox} 10u 50u 100% 10u "&Launch ${ProgramName}"
Pop $CheckboxRunProgram
${If} $CheckboxRunProgram_State == ${BST_CHECKED}
${NSD_Check} $CheckboxRunProgram
${EndIf}
# alternative for the above ${If}:
#${NSD_SetState} $Checkbox_State
nsDialogs::Show
FunctionEnd
Function postInstallFinish
${NSD_GetState} $CheckboxReadme $CheckboxReadme_State
${NSD_GetState} $CheckboxRunProgram $CheckboxRunProgram_State
${If} $CheckboxReadme_State == ${BST_CHECKED}
ExecShell "open" "https://github.com/Walkman-Mirror/${ProgramName}Gecko/blob/gecko/README.md#basicbrowser-"
${EndIf}
${If} $CheckboxRunProgram_State == ${BST_CHECKED}
ExecShell "open" "$INSTDIR\${ProgramName}.exe"
${EndIf}
FunctionEnd
; Uninstaller
Section "Uninstall"
Delete $INSTDIR\${ProgramName}(Gecko)-Uninst.exe ; Remove Application Files
Delete $INSTDIR\${ProgramName}.exe
; DLLs
Delete $INSTDIR\*.dll
; Sub-Folders
Delete /r "chrome"
Delete /r "components"
Delete /r "defaults"
Delete /r "dictionaries"
Delete /r "greprefs"
Delete /r "modules"
Delete /r "plugins"
Delete /r "res"
RMDir $INSTDIR
RMDir chrome
RMDir components
RMDir defaults
RMDir dictionaries
RMDir greprefs
RMDir modules
RMDir plugins
RMDir res
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProgramName}" ; Remove Windows Programs & Features integration (uninstall info)
Delete "$SMPROGRAMS\DeavmiOSS\${ProgramName}(Gecko).lnk" ; Remove Start Menu Shortcuts & Folder
Delete "$SMPROGRAMS\DeavmiOSS\Uninstall ${ProgramName}(Gecko).lnk"
RMDir $SMPROGRAMS\DeavmiOSS
Delete "$DESKTOP\${ProgramName}(Gecko).lnk" ; Remove Desktop Shortcut
Delete "$QUICKLAUNCH\${ProgramName}(Gecko).lnk" ; Remove Quick Launch Shortcut
DeleteRegKey HKCR Applications\${ProgramName}(Gecko).exe ; Remove open with association
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\OpenWithList" "k"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice" "Progid" "Applications\chrome.exe"
SectionEnd
; Uninstaller Functions
Function un.onInit
SetShellVarContext all
SetAutoClose true
FunctionEnd
Function un.onUninstFailed
MessageBox MB_OK "Uninstall Cancelled"
FunctionEnd
Function un.onUninstSuccess
MessageBox MB_OK "Uninstall Completed"
FunctionEnd