-
Notifications
You must be signed in to change notification settings - Fork 1
/
uniqueness-install.nsi
107 lines (74 loc) · 3.07 KB
/
uniqueness-install.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
; note that this uses the NSIS DotNetChecker https://github.com/ReVolly/NsisDotNetChecker
!include "DotNetChecker.nsh"
!include "MUI2.nsh"
Name "Uniqueness"
OutFile "Uniqueness-Install.exe"
!define MUI_ICON "Uniqueness\Resources\Corteva.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Uniqueness\Resources\CortevaLegal_HorColor_RGB_no_tagline.bmp"
!define MUI_HEADERIMAGE_RIGHT
;Default installation folder
InstallDir "$LOCALAPPDATA\Corteva Agriscience\Uniqueness"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Corteva Agriscience\Uniqueness" ""
;Request application privileges for Windows Vista
RequestExecutionLevel highest
;--------------------------------
;Variables
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "License.rtf"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Corteva Agriscience\Uniqueness"
!define MUI_STARTMENUPAGE_Application_DEFAULTFOLDER "Corteva Agriscience\Uniqueness"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
#!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Application" SecDummy
!insertmacro CheckNetFramework 461
SetOutPath "$INSTDIR"
File /r "Uniqueness\bin\Release\*.exe"
File /r "Uniqueness\bin\Release\*.dll"
File /r "Uniqueness\bin\Release\*.pdf"
File /r "Uniqueness\bin\Release\*.pdb"
;Store installation folder
WriteRegStr HKCU "Software\Corteva Agriscience\Uniqueness" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\Corteva Agriscience\$StartMenuFolder"
CreateShortcut "$SMPROGRAMS\Corteva Agriscience\Uniqueness.lnk" "$INSTDIR\Uniqueness.exe"
CreateShortcut "$SMPROGRAMS\Corteva Agriscience\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
;!insertmacro MUI_STARTMENU_WRITE_END
ExecShell "" '"$INSTDIR\Uniqueness.exe"'
SectionEnd
Section "Example Files" SecDummy1
SetOutPath "$INSTDIR\Example"
File /r "Uniqueness\bin\Release\Example"
SectionEnd
;Uninstaller Section
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\Corteva Agriscience\Uniqueness.lnk"
Delete "$SMPROGRAMS\Corteva Agriscience\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
RMDIR "$SMPROGRAMS\Corteva Agriscience\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\Corteva Agriscience\Uniqueness"
SectionEnd