-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.nsi
executable file
·257 lines (223 loc) · 10.5 KB
/
setup.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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# Auto-generated by EclipseNSIS Script Wizard
# 04.10.2007 23:14:20
# ###############################################################
#
# ACHTUNG - Vor der Erstellung des Setups die Reihenfolge beachten:
#
# 0. Encoding dieser Datei muss "ISO-8859-1" sein!
# 1. In der plugin.xml die richtige Versionsnummer eintragen
# 2. Diese Versionsnummer auch in diesem Skript unter <VERSION> eintragen
# 2. Aus der de.intranda.psych.product den Eclipse Product Export Wizard starten
# 3. Product nach <PRODUCTPATH> (siehe unten) exportieren
# 6. Ggf. aktuelisierte PDF-Dokumentation erzeugen
# 7. PDF-Dokumentation erzeugen und in <PRODUCTPATH> als 'Manual.pdf' ablegen
#
# ###############################################################
Name "Goobi-Viewer-Desktop-Client"
SetCompressor lzma
#RequestExecutionLevel admin
!include x64.nsh
!ifndef PRODUCTPATH
!define PRODUCTPATH "/opt/digiverso/git/goobi-viewer-desktop/out/nsis/*"
!endif
!define INSTALLPATH "intranda\goobi-viewer-desktop"
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!ifndef VERSION
!define VERSION 1.1.0.dev20130212
!endif
!define COMPANY "intranda GmbH"
!define URL http://www.intranda.com
# MUI defines
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(^OptionCreateDesktopIcon)"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDesktopIcon
#!define MUI_FINISHPAGE_RUN
#!define MUI_FINISHPAGE_RUN_TEXT "$(^OptionLaunchApplication)"
#!define MUI_FINISHPAGE_RUN_FUNCTION LaunchLink
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${INSTALLPATH}"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
; MUI Settings / Icons
!ifndef MUI_ICON
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!endif
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
; MUI Settings / Header
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-r.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall-r.bmp"
; MUI Settings / Wizard
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
# Included files
!include Sections.nsh
!include MUI.nsh
# Variables
Var StartMenuGroup
# Installer pages
!insertmacro MUI_PAGE_WELCOME
#!insertmacro MUI_PAGE_LICENSE license.txt
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE German
# Installer attributes
OutFile "${PATH_OUTFILE}"
InstallDir "$PROGRAMFILES\${INSTALLPATH}"
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion 1.0.0.0
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName "$(^Name)"
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription ""
VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
# Installer sections
Section -Main SEC0000
SetOutPath $INSTDIR
SetOverwrite on
############# Ausgangsverzeichnis ###############
File /r ${PRODUCTPATH}
############# // Ausgangsverzeichnis ############
WriteRegStr HKLM "${REGKEY}\Components" Main 1
SectionEnd
Section -post SEC0001
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLUpdateInfo "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" HelpLink "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" InstallLocation $INSTDIR
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
# From here on, commands will apply to all user accounts on the system
SetShellVarContext all
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath $SMPROGRAMS\$StartMenuGroup
SetOutPath $INSTDIR
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^LaunchLink).lnk" "$INSTDIR\$(^Name).exe"
#CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^DocLink).lnk" "$INSTDIR\$(^Name)_Manual.pdf"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^IntrandaLink).lnk" "http://www.intranda.com"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^DigiversoLink).lnk" "http://www.digiverso.com"
#CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
CreateShortCut "$DESKTOP\$(^LaunchLink).lnk" "$INSTDIR\$(^Name).exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
DeleteRegValue HKLM "${REGKEY}\Components" Main
Delete /REBOOTOK $INSTDIR\uninstall.exe
RmDir /r /REBOOTOK $INSTDIR
SectionEnd
Section -un.post UNSEC0001
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
# From here on, commands will apply to all user accounts on the system
SetShellVarContext all
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^LaunchLink).lnk"
#Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^DocLink).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^IntdandaLink).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^DigiversoLink).lnk"
#Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
RmDir /r /REBOOTOK $SMPROGRAMS\$StartMenuGroup
Delete "$DESKTOP\$(^LaunchLink).lnk"
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
# Admin check (works on W2K and newer)
System::Call "kernel32::GetModuleHandle(t 'shell32.dll') i .s"
System::Call "kernel32::GetProcAddress(i s, i 680) i .r0"
System::Call "::$0() i .r0"
IntCmp $0 0 isNotAdmin isNotAdmin isAdmin
isNotAdmin:
messageBox MB_OK|MB_ICONEXCLAMATION "$(^AdminRequiredMessage)"
Abort
isAdmin:
############# Deinstallation vor der Neuinstallation ###############
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(^Name) ist bereits installiert. $\n$\nKlicken Sie `OK` um die vorherige Version zu deinstallieren oder `Abbrechen` um die Installation abzubrechen." IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;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:
############# // Deinstallation vor der Neuinstallation ###############
FunctionEnd
# Uninstaller functions
Function un.onInit
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd
Function CreateDesktopIcon
SetShellVarContext all
CreateShortCut "$DESKTOP\$(^LaunchLink).lnk" "$INSTDIR\$(^Name).exe"
Functionend
#Function LaunchLink
# #SetShellVarContext current
# ExecShell "" "$SMPROGRAMS\$StartMenuGroup\$(^LaunchLink).lnk"
#FunctionEnd
# Installer Language Strings
LangString ^IntrandaLink ${LANG_ENGLISH} "intranda Website"
LangString ^IntrandaLink ${LANG_GERMAN} "intranda Website"
LangString ^DigiversoLink ${LANG_ENGLISH} "Digiverso Website"
LangString ^DigiversoLink ${LANG_GERMAN} "Digiverso Website"
LangString ^DocLink ${LANG_ENGLISH} "$(^Name) Documentation"
LangString ^DocLink ${LANG_GERMAN} "$(^Name) Dokumentation"
LangString ^LaunchLink ${LANG_ENGLISH} "Launch $(^Name)"
LangString ^LaunchLink ${LANG_GERMAN} "$(^Name) starten"
LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
LangString ^UninstallLink ${LANG_GERMAN} "$(^Name) deinstallieren"
LangString ^AdminRequiredMessage ${LANG_ENGLISH} "You must be logged in with an administrator account to install this application!"
LangString ^AdminRequiredMessage ${LANG_GERMAN} "Um diese Anwendung zu installieren, ist eine Anmeldung mit einem Administrator-Konto erforderlich!"
LangString ^OptionCreateDesktopIcon ${LANG_ENGLISH} "Create desktop shortcut"
LangString ^OptionCreateDesktopIcon ${LANG_GERMAN} "Desktop-Verknüpfung erstellen"
LangString ^OptionLaunchApplication ${LANG_ENGLISH} "Launch application"
LangString ^OptionLaunchApplication ${LANG_GERMAN} "Anwendung starten"