-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.nsi
110 lines (72 loc) · 2.53 KB
/
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
!addplugindir "prereq\nsis"
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "Avocado Installer"
OutFile "dist\Avocado Installer.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Avocado"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Avocado" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
!include LogicLib.nsh
Function .onInit
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
MessageBox mb_iconstop "Administrator rights required!"
SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
Quit
${EndIf}
FunctionEnd
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
; !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!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"
;--------------------------------
;Installer Sections
Section "Avocado" SecAvocado
SetOutPath "$INSTDIR"
File "dist\avocado.exe"
File "settings.conf"
CreateShortCut "$DESKTOP\Avocado.lnk" "$INSTDIR\avocado.exe"
;Store installation folder
WriteRegStr HKCU "Software\Avocado" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Add to Startup" SecStartup
CreateShortCut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\Avocado.lnk" "$INSTDIR\avocado.exe"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecAvocado ${LANG_ENGLISH} "Install Avocado."
LangString DESC_SecStartup ${LANG_ENGLISH} "Add to startup directory."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecAvocado} $(DESC_SecAvocado)
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartup} $(DESC_SecStartup)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR\*.*"
DeleteRegKey /ifempty HKCU "Software\Avocado"
SectionEnd