-
Notifications
You must be signed in to change notification settings - Fork 6
/
anno-installer.nsi
97 lines (73 loc) · 2.83 KB
/
anno-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
!define VERSION "$%APPVEYOR_BUILD_VERSION%"
!include "MUI.nsh"
!include "FileFunc.nsh"
Name "anno"
OutFile "anno-installer-v${VERSION}.exe"
InstallDir "$PROGRAMFILES64\anno"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Launch anno"
!define MUI_FINISHPAGE_RUN_FUNCTION "Launch"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
# From: https://stackoverflow.com/a/28335075/19254
!ifndef QTDIR
!define QTDIR "$%QTDIR%"
!endif
!if ! /fileexists "${QTDIR}"
!error "QTDIR not valid"
!endif
Section "Main Section" MainSec
CreateDirectory $INSTDIR
CreateDirectory $INSTDIR\bin
WriteUninstaller $INSTDIR\anno-uninstaller.exe
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno" "DisplayName" "anno"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno" "UninstallString" "$\"$INSTDIR\anno-uninstaller.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno" "Publisher" "Tomaattinen Ltd (Juha Reunanen)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno" "DisplayIcon" "$INSTDIR\bin\anno.exe,0"
DetailPrint "Copying files..."
SetOutPath $INSTDIR\bin
File release\anno.exe
File ${QTDIR}\bin\Qt5Core.dll
File ${QTDIR}\bin\Qt5Gui.dll
File ${QTDIR}\bin\Qt5Widgets.dll
SetOutPath $INSTDIR\bin\platforms
File ${QTDIR}\plugins\platforms\qwindows.dll
SetOutPath $INSTDIR\bin\imageformats
File ${QTDIR}\plugins\imageformats\qjpeg.dll
SetOutPath $INSTDIR # The working directory for the shortcuts - should perhaps be something else?
CreateShortCut "$INSTDIR\anno.lnk" "$INSTDIR\bin\anno.exe" ""
CreateShortCut "$SMPROGRAMS\anno.lnk" "$INSTDIR\bin\anno.exe" ""
CreateShortCut "$DESKTOP\anno.lnk" "$INSTDIR\bin\anno.exe" ""
# Estimate installed size
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno" "EstimatedSize" "$0"
SectionEnd
Function Launch
ExecShell "" "$INSTDIR\anno.lnk"
FunctionEnd
Section "Uninstall"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\anno"
DeleteRegKey HKCU "Software\Tomaattinen\anno"
Delete $INSTDIR\anno-uninstaller.exe
Delete $INSTDIR\anno.lnk
Delete $SMPROGRAMS\anno.lnk
Delete $DESKTOP\anno.lnk
Delete $INSTDIR\bin\anno.exe
Delete $INSTDIR\bin\imageformats\*.dll
Delete $INSTDIR\bin\platforms\*.dll
Delete $INSTDIR\bin\*.dll
RMDir $INSTDIR\bin\imageformats
RMDir $INSTDIR\bin\platforms
RMDir $INSTDIR\bin
RMDir $INSTDIR
Delete "$SMPROGRAMS\anno.lnk"
Delete "$DESKTOP\anno.lnk"
SectionEnd