-
Notifications
You must be signed in to change notification settings - Fork 11
/
nsis_installer.nsi
185 lines (127 loc) · 4.98 KB
/
nsis_installer.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
; nsis_installer.nsi
;
; This script is based on example1.nsi, but it remember the directory,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install example2.nsi into a directory that the user selects.
;
; See install-shared.nsi for a more robust way of checking for administrator rights.
; See install-per-user.nsi for a file association example.
;--------------------------------
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
; The name of the installer
Name "OpenXRechnungToolbox v3.0.0"
; The icon
Icon "resources/images/oxt.ico"
; The file to write
OutFile "OpenXRechnungToolbox_v3.0.0_Installer.exe"
; Request application privileges for Windows Vista and higher
RequestExecutionLevel admin
; Build Unicode installer
Unicode True
; The default installation directory
InstallDir $PROGRAMFILES\OpenXRechnungToolbox
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\OpenXRechnungToolbox" "Install_Dir"
; sign the installer; insert storepass password; insert the outfile name at the end
!finalize 'java -jar jsign.jar --keystore ../keystore.jks --alias ssl --storepass password --tsaurl http://timestamp.sectigo.com OpenXRechnungToolbox_v3.0.0_Installer.exe'
;--------------------------------
; Pages
;Page components
;Page directory
;Page instfiles
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_TEXT "OpenXRechnungToolbox starten"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "English"
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
;Reserve Files
;If you are using solid compression, files that are required before
;the actual installation should be stored first in the data block,
;because this will make your installer start faster.
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
; The stuff to install
Section "Installation (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "OpenXRechnungToolbox.exe"
File "license.txt"
File "knownIssues.txt"
File "CHANGELOG.md"
File /r "resources"
File /r "openJDK"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\OpenXRechnungToolbox "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenXRechnungToolbox" "DisplayName" "OpenXRechnungToolbox"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenXRechnungToolbox" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenXRechnungToolbox" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenXRechnungToolbox" "NoRepair" 1
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
;Installer Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
;--------------------------------
Function LaunchLink
ExecShell "" "$SMPROGRAMS\OpenXRechnungToolbox\OpenXRechnungToolbox.lnk"
FunctionEnd
;--------------------------------
; Optional section (can be disabled by the user)
Section "Example Invoices (optional)"
;SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
File /r "exampleInvoices"
SectionEnd
;--------------------------------
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\OpenXRechnungToolbox"
CreateShortcut "$SMPROGRAMS\OpenXRechnungToolbox\OpenXRechnungToolbox.lnk" "$INSTDIR\OpenXRechnungToolbox.exe"
CreateShortcut "$SMPROGRAMS\OpenXRechnungToolbox\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenXRechnungToolbox"
DeleteRegKey HKLM SOFTWARE\OpenXRechnungToolbox
; Remove files and uninstaller
Delete $INSTDIR\OpenXRechnungToolbox.exe
Delete $INSTDIR\license.txt
Delete $INSTDIR\knownIssues.txt
Delete $INSTDIR\CHANGELOG.md
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\OpenXRechnungToolbox\*.lnk"
; Remove directories
RMDir /r "$INSTDIR\OpenXRechnungToolbox\resources"
RMDir /r "$INSTDIR\OpenXRechnungToolbox\openJDK"
RMDir "$SMPROGRAMS\OpenXRechnungToolbox"
RMDir /r "$INSTDIR"
SectionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd