-
Notifications
You must be signed in to change notification settings - Fork 0
/
Checkout_installer.nsi
138 lines (93 loc) · 3.37 KB
/
Checkout_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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
; Turn off old selected section
; 12 06 2005: Luis Wong
; Template to generate an installer
; Especially for the generation of EasyPlayer installers
; Trimedia Interactive Projects
; -------------------------------
; Start
!define NAME "SPCANN - Checkout"
!define MUI_FILE "Checkout"
!define VERSION "1.0"
!define MUI_BRANDINGTEXT "Checkout"
!define SLUG "${NAME} v${VERSION}"
!define ProjectDir "C:\Users\Ohana\PycharmProjects\SPCA-Automation"
!define InputDir "${ProjectDir}\dist\Checkout"
CRCCheck On
; We should test if we must use an absolute path
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
;---------------------------------
;General
OutFile "${ProjectDir}\inst\Install ${MUI_FILE} ${VERSION}.exe"
ShowInstDetails "hide"
ShowUninstDetails "hide"
Name "${NAME}"
;SetCompressor "bzip2"
;!define MUI_ICON "icon.ico"
;!define MUI_UNICON "icon.ico"
;!define MUI_SPECIALBITMAP "Bitmap.bmp"
;--------------------------------
;Folder selection page
InstallDir "$PROGRAMFILES\${NAME}"
;--------------------------------
;Modern UI Configuration
!define MUI_WELCOMEPAGE
;!define MUI_LICENSEPAGE
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!define MUI_FINISHPAGE
;--------------------------------
;Language
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Modern UI System
;!insertmacro MUI_SYSTEM
;--------------------------------
;Data
;LicenseData "Read_me.txt"
;--------------------------------
;Installer Sections
Section "install"
;Add files
SetOutPath "$INSTDIR"
File "${ProjectDir}\README.md"
File "${InputDir}\${MUI_FILE}.exe"
file /r ${InputDir}\*
;create desktop shortcut
CreateShortCut "$DESKTOP\${NAME}.lnk" "$INSTDIR\${MUI_FILE}.exe" ""
;create start-menu items
CreateDirectory "$SMPROGRAMS\${NAME}"
CreateShortCut "$SMPROGRAMS\${NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${NAME}\${NAME}.lnk" "$INSTDIR\${MUI_FILE}.exe" "" "$INSTDIR\${MUI_FILE}.exe" 0
;write uninstall information to the registry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "DisplayName" "${NAME} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Delete Files
RMDir /r "$INSTDIR\*.*"
;Remove the installation directory
RMDir "$INSTDIR"
;Delete Start Menu Shortcuts
Delete "$DESKTOP\${NAME}.lnk"
Delete "$SMPROGRAMS\${NAME}\*.*"
RmDir "$SMPROGRAMS\${NAME}"
;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
SectionEnd
;--------------------------------
;MessageBox Section
;Function that calls a messagebox when installation finished correctly
Function .onInstSuccess
MessageBox MB_OK "You have successfully installed ${NAME}."
FunctionEnd
Function un.onUninstSuccess
MessageBox MB_OK "You have successfully uninstalled ${NAME}."
FunctionEnd
;eof