-
Notifications
You must be signed in to change notification settings - Fork 36
/
install.nsi
84 lines (66 loc) · 1.93 KB
/
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
!include LogicLib.nsh
!include "MUI.nsh"
; Set the name and output file of the installer
Outfile "windows_x64_installer.exe"
; Set the name and version of the application
Name "Fastn"
; Set Version of installer
VIProductVersion "${VERSION}"
; Default installation directory
InstallDir $PROGRAMFILES64\fastn
!define PRODUCT_NAME "fastn"
; Uninstaller name
!define UNINSTALLER_NAME "uninstall.exe"
; Styling
!define MUI_BRANDINGTEXT "fastn ${VERSION}"
!define MUI_ICON "fastn.ico"
!define MUI_INSTFILESPAGE_COLORS "FFFFFF 000000"
!define MUI_BGCOLOR 000000
!define MUI_TEXTCOLOR ffffff
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_SHOWREADME "https://fastn.com"
CRCCheck On
; Request application privileges for installation
RequestExecutionLevel admin
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ${CURRENT_WD}\LICENSE
!insertmacro MUI_PAGE_INSTFILES
; Default Language
!insertmacro MUI_LANGUAGE "English"
; Sections
Section "Fastn Installer" SectionOne
; check for write permissions in path
EnVar::Check "NULL" "NULL"
Pop $0
DetailPrint "EnVar::Check write access HKCU returned=|$0|"
; Set the output path for installation
SetOutPath $INSTDIR
; CURRENT_WD is provided through cmd arguments
; Copy application files
File ${CURRENT_WD}/result/bin/fastn.exe
File ${CURRENT_WD}/LICENSE
File ${CURRENT_WD}/README.md
; Set the Path variables
EnVar::SetHKCU
EnVar::Check "Path" "$InstDir"
Pop $0
${If} $0 = 0
DetailPrint "Already there"
${Else}
EnVar::AddValue "Path" "$InstDir"
Pop $0 ; 0 on success
${EndIf}
; Write an uninstaller
WriteUninstaller "${UNINSTALLER_NAME}"
SectionEnd
Section "Uninstall"
; Uninstaller section
Delete "$INSTDIR\fastn.exe"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\README.md"
RMDir "$INSTDIR"
; Remove from PATH
EnVar::SetHKCU
EnVar::DeleteValue "Path" "$InstDir"
SectionEnd