forked from jcelaya/hdrmerge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.nsi
126 lines (93 loc) · 3.83 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
!include MUI2.nsh
!include FileFunc.nsh
!define APPNAME "HDRMerge@WIN_ARCH@"
; The name of the installer
Name "${APPNAME} v@HDRMERGE_VERSION@"
; The file to write
OutFile "@SETUP_PROG@"
; The default installation directory
InstallDir $PROGRAMFILES@WIN_ARCH@\HDRMerge
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\${APPNAME}" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Version Information
VIProductVersion "@[email protected]"
VIAddVersionKey "ProductName" "${APPNAME}"
VIAddVersionKey "CompanyName" "Javier Celaya"
VIAddVersionKey "LegalCopyright" "Copyright Javier Celaya"
VIAddVersionKey "FileDescription" "${APPNAME}"
VIAddVersionKey "FileVersion" "@HDRMERGE_VERSION@"
VIAddVersionKey "ProductVersion" "@HDRMERGE_VERSION@"
!define MUI_ICON "@PROJECT_SOURCE_DIR@/images/icon.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "@PROJECT_SOURCE_DIR@/images/logo.bmp"
!define MUI_HEADERIMAGE_RIGHT
;--------------------------------
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "@PROJECT_SOURCE_DIR@/LICENSE"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
Section "HDRMerge (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "hdrmerge.exe" \
"@PROJECT_SOURCE_DIR@/LICENSE" \
"@PROJECT_SOURCE_DIR@/LICENSE_icons" \
"@PROJECT_SOURCE_DIR@/README.md"
File /oname=hdrmerge.com "hdrmerge-nogui.exe"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\${APPNAME} "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
!define ARP "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
WriteRegStr HKLM "${ARP}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "${ARP}" "DisplayIcon" "$INSTDIR\hdrmerge.exe"
WriteRegStr HKLM "${ARP}" "DisplayVersion" "@HDRMERGE_VERSION@"
WriteRegStr HKLM "${ARP}" "InstallLocation" "$INSTDIR"
; Compute installed size
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "${ARP}" "EstimatedSize" "$0"
WriteRegStr HKLM "${ARP}" "Publisher" "Javier Celaya"
WriteRegStr HKLM "${ARP}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "${ARP}" "NoModify" 1
WriteRegDWORD HKLM "${ARP}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${APPNAME}\HDRMerge.lnk" "$INSTDIR\hdrmerge.exe" "" "$INSTDIR\hdrmerge.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM SOFTWARE\${APPNAME}
; Remove shortcuts, if any
Delete "$SMPROGRAMS\${APPNAME}\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\${APPNAME}"
Delete "$INSTDIR\hdrmerge.exe"
Delete "$INSTDIR\hdrmerge.com"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\LICENSE_icons"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\uninstall.exe"
RMDir /REBOOTOK $INSTDIR
SectionEnd