-
Notifications
You must be signed in to change notification settings - Fork 1
/
glogg.nsi
170 lines (139 loc) · 5.7 KB
/
glogg.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
# NSIS script creating the Windows installer for glogg
# Is passed to the script using -DVERSION=$(git describe) on the command line
!ifndef VERSION
!define VERSION 'anonymous-build'
!endif
# Headers
!include "MUI2.nsh"
!include "FileAssociation.nsh"
# General
OutFile "glogg-${VERSION}-setup.exe"
XpStyle on
SetCompressor /SOLID lzma
; Registry key to keep track of the directory we are installed in
!ifdef ARCH32
InstallDir "$PROGRAMFILES\glogg"
!else
InstallDir "$PROGRAMFILES64\glogg"
!endif
InstallDirRegKey HKLM Software\glogg ""
; glogg icon
; !define MUI_ICON glogg.ico
RequestExecutionLevel admin
Name "glogg"
Caption "glogg ${VERSION} Setup"
# Pages
!define MUI_WELCOMEPAGE_TITLE "Welcome to the glogg ${VERSION} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of glogg\
, a fast, advanced log explorer.$\r$\n$\r$\n\
glogg and the Qt libraries are released under the GPL, see \
the COPYING file.$\r$\n$\r$\n$_CLICK"
; MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/"
!insertmacro MUI_PAGE_WELCOME
;!insertmacro MUI_PAGE_LICENSE "COPYING"
# !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD...
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
# Languages
!insertmacro MUI_LANGUAGE "English"
# Installer sections
Section "glogg" glogg
; Prevent this section from being unselected
SectionIn RO
SetOutPath $INSTDIR
File release\glogg.exe
File COPYING
File README.md
; Create the 'sendto' link
CreateShortCut "$SENDTO\glogg.lnk" "$INSTDIR\glogg,exe" "" "$INSTDIR\glogg.exe" 0
; Register as an otion (but not main handler) for some files (.txt, .Log, .cap)
WriteRegStr HKCR "Applications\glogg.exe" "" ""
WriteRegStr HKCR "Applications\glogg.exe\shell" "" "open"
WriteRegStr HKCR "Applications\glogg.exe\shell\open" "FriendlyAppName" "glogg"
WriteRegStr HKCR "Applications\glogg.exe\shell\open\command" "" '"$INSTDIR\glogg.exe" "%1"'
WriteRegStr HKCR "*\OpenWithList\glogg.exe" "" ""
WriteRegStr HKCR ".txt\OpenWithList\glogg.exe" "" ""
WriteRegStr HKCR ".Log\OpenWithList\glogg.exe" "" ""
WriteRegStr HKCR ".cap\OpenWithList\glogg.exe" "" ""
; Register uninstaller
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
"UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"\
"InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayName" "glogg"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "DisplayVersion" "${VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg" "NoRepair" "1"
; Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Qt5 Runtime libraries" qtlibs
SetOutPath $INSTDIR
File release\Qt5Core.dll
File release\Qt5Gui.dll
File release\Qt5Network.dll
File release\Qt5Widgets.dll
File release\libwinpthread-1.dll
SetOutPath $INSTDIR\platforms
File release\qwindows.dll
SectionEnd
Section "Create Start menu shortcut" shortcut
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\glogg.lnk" "$INSTDIR\glogg.exe" "" "$INSTDIR\glogg.exe" 0
SectionEnd
Section /o "Associate with .log files" associate
${registerExtension} "$INSTDIR\glogg.exe" ".log" "Log file"
SectionEnd
# Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${glogg} "The core files required to use glogg."
!insertmacro MUI_DESCRIPTION_TEXT ${qtlibs} "Needed by glogg, you have to install these unless \
you already have the Qt5 development kit installed."
!insertmacro MUI_DESCRIPTION_TEXT ${shortcut} "Create a shortcut in the Start menu for glogg."
!insertmacro MUI_DESCRIPTION_TEXT ${associate} "Make glogg the default viewer for .log files."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
# Uninstaller
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\glogg.exe"
Delete "$INSTDIR\README"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\mingwm10.dll"
Delete "$INSTDIR\libgcc_s_dw2-1.dll"
Delete "$INSTDIR\QtCore4.dll"
Delete "$INSTDIR\QtGui4.dll"
Delete "$INSTDIR\QtNetwork4.dll"
Delete "$INSTDIR\Qt5Core.dll"
Delete "$INSTDIR\Qt5Gui.dll"
Delete "$INSTDIR\Qt5Network.dll"
Delete "$INSTDIR\Qt5Widgets.dll"
Delete "$INSTDIR\libwinpthread-1.dll"
Delete "$INSTDIR\platforms\qwindows.dll"
RMDir "$INSTDIR"
; Remove settings in %appdata%
Delete "$APPDATA\glogg\glogg.ini"
RMDir "$APPDATA\glogg"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\glogg"
; Remove settings in the registry (from glogg < 0.9)
DeleteRegKey HKCU "Software\glogg"
; Remove the file associations
${unregisterExtension} ".log" "Log file"
DeleteRegKey HKCR "*\OpenWithList\glogg.exe"
DeleteRegKey HKCR ".txt\OpenWithList\glogg.exe"
DeleteRegKey HKCR ".Log\OpenWithList\glogg.exe"
DeleteRegKey HKCR ".cap\OpenWithList\glogg.exe"
DeleteRegKey HKCR "Applications\glogg.exe\shell\open\command"
DeleteRegKey HKCR "Applications\glogg.exe\shell\open"
DeleteRegKey HKCR "Applications\glogg.exe\shell"
DeleteRegKey HKCR "Applications\glogg.exe"
; Remove the shortcut, if any
SetShellVarContext all
Delete "$SMPROGRAMS\glogg.lnk"
SectionEnd