-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPEP.nsi
More file actions
214 lines (182 loc) · 9.6 KB
/
PEP.nsi
File metadata and controls
214 lines (182 loc) · 9.6 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# Initially Auto-generated by EclipseNSIS Script Wizard
# Jun 21, 2010 5:12:58 PM
# Modified by hand over the years after initial generation.
# See https://www.codeproject.com/Articles/24187/Creating-an-Installer for
# an introduction to NSIS installer scripts.
# --------------------------------------------------------------------------
# Georgia Southern University Research Services Foundation
# donated by NCR to the research foundation in 2002 and maintained here
# since. Created open source version using MIT license without proprietary
# information and created OpenGenPOS GitHub repository, https://github.com/opengenpos/genpos
# 2002 -> NHPOS Rel 1.4 (Windows CE for NCR 7448, Visual Studio Embedded)
# 2003 -> NHPOS Rel 2.0.0 (Windows XP for NCR touch screen, Datacap for EPT)
# 2006 -> NHPOS Rel 2.0.4 (Windows XP, Rel 2.0.4.51)
# 2006 -> NHPOS Rel 2.0.5 (Windows XP, US Customs, Store and Forward, Mobile Terminal, Rel 2.0.5.76)
# 2007 -> NHPOS Rel 2.1.0 (Windows XP, Condiment Edit and Tim Horton without Rel 2.0.5 changes, Rel 2.1.0.141)
# 2012 -> GenPOS Rel 2.2.0 (Windows 7, Amtrak and VCS, merge Rel 2.0.5 into Rel 2.1.0)
# 2014 -> GenPOS Rel 2.2.1 (Windows 7, Datacap Out of Scope, US Customs, Amtrak, VCS)
# 2016 -> GenPOS Rel 2.2.2 (Windows 7, maintenance releases using Visual Studio 2005 in parallel with Rel 2.3.0 using Visual Studio 2013)
# 2015 -> GenPOS Rel 2.3.0 (Windows 7, EMV card support, Out Of Scope control, compiler change to Visual Studio 2013 from Visual Studio 2005)
# 2019 -> GenPOS Rel 2.3.1 (Windows 10, compiler change to Visual Studio 2015 from Visual Studio 2013)
# 2020 -> GenPOS Rel 2.3.2 (Unreleased. Windows 10, 64 bit totals)
# 2021 -> GenPOS Rel 2.4.0 (Conversion to OpenGenPOS)
#
# moved from Visual Studio 6.0 to Visual Studio 2005 with Rel 2.2.0
# moved from Visual Studio 2015 to Visual Studio 2019 with Rel 2.4.0
# General Symbol Definitions
# NOTE: NSSIS installer has a number of predefined symbols that are used
# when updating/modifying the Windows Registry. See the following:
# - HKLM is HKEY_LOCAL_MACHINE
# - HKCU is HKEY_CURRENT_USER
# - HKCR is HKEY_CLASSES_ROOT
#
# NOTE: with 64 bit Windows OS, 32 bit entries get written to HKLM\Software\Wow6432Node rather than HKLM\Software
Name "OpenGenPOS Parameter Entry Program (PEP)"
!define REGKEY "SOFTWARE\$(^Name)"
!define REGKEY_UNINSTALL "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
# NOTE: Change the build version number here as well as
# places where ALL_N_VERSIONINFO and ALL_M_VERSIONINFO
# are defined.
# See as well the copyright macro ALL_Q_COPYRIGHT.
# See as well macro for OutFile below containing installer file name.
!define VERSION 2.4.0.004
!define COMPANY OpenGenPOS
!define URL https://github.com/opengenpos
!define PEPDIR Pep2.4
# MUI Symbol Definitions
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
# Included files
!include Sections.nsh
!include MUI2.nsh
# Variables
Var StartMenuGroup
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile PEP_rel_02_04_00_004.exe
InstallDir $PROGRAMFILES\NCR\NeighborhoodPOS\Pep2.4
CRCCheck force
XPStyle on
ShowInstDetails show
VIProductVersion "${VERSION}"
VIAddVersionKey ProductName "$(^Name)"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey FileDescription "OpenGenPOS PEP Installer"
VIAddVersionKey LegalCopyright "Copyright (C) 2002-2024, Georgia Southern University"
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
RequestExecutionLevel admin
# Installer sections
Section -Main SEC0000
SetOverwrite on
SetOutPath $FONTS
File andalemo.ttf
SetOutPath $INSTDIR
File /r PEP\bin\release\*.dll
File /r PEP\bin\release\*.exe
# File /r PEP\bin\release\*.chm
# Beginning with Visual Studio 2017, it appears the directory structure has changed somewhat
# previous versions of Visual Studio such as Visual Studio 2015 and Visual Studio 2005.
# Visual Studio 2019 Community Edition
File "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\vcredist_x86.exe"
# Visual Studio 2015
# File "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\1033\vcredist_x86.exe"
# The location of the Visual Studio 2005 C++ Runtime Redistributable depends on the version of
# Windows being used to build the application. Beginning with Windows 7 there are now two different
# folder hierarchies for installed programs.
# Visual Studio 2005
# File "C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\vcredist_x86.exe"
# File "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\vcredist_x86.exe"
CreateDirectory "$SMPROGRAMS\$StartMenuGroup"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\GenPOS Layout Manager.lnk" $INSTDIR\NHPOSLM.exe
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\GenPOS PEP.lnk" $INSTDIR\pep.exe
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\GenPOS PEP Help.lnk" $INSTDIR\pephelp.chm
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\GenPOS PCSample.lnk" $INSTDIR\PCSample.exe
#creates the filetype association for pep settings documents
WriteRegStr HKCR ".pep" "" "pep.Document" #associate extension
WriteRegStr HKCR "pep.Document" "" "OpenGenPOS PEP Settings File" #give friendly name
WriteRegStr HKCR "pep.Document\DefaultIcon" "" "$INSTDIR\pep.exe,0" #set default icon
WriteRegStr HKCR "pep.Document\shell\open\command" "" '"$INSTDIR\pep.exe" "%1"' #set open command
# ExecWait '"$INSTDIR\vcredist_x86.exe"' #normal run (dialog with cancel button)
ExecWait '"$INSTDIR\vcredist_x86.exe" /q:a /c:"msiexec /i vcredist.msi /qb!"' #dialog with no cancel
# ExecWait '"$INSTDIR\vcredist_x86.exe" /q:a /c:"msiexec /i vcredist.msi /qn"' #totally silent
WriteRegStr HKLM "${REGKEY}\Components" Main 1
SectionEnd
Section -post SEC0001
Delete /REBOOTOK vcredist_x86.exe
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
SetOutPath $SMPROGRAMS\$StartMenuGroup
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
#remove filetype association
DeleteRegKey HKCR ".pep"
DeleteRegKey HKCR "pep.Document"
DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0001
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK $INSTDIR\uninstall.exe
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
# remove the installation directories
RmDir /r /REBOOTOK $SMPROGRAMS\$StartMenuGroup
RmDir /r /REBOOTOK $INSTDIR
# remove the parent directories if they are empty
RmDir /REBOOTOK $PROGRAMFILES\NCR\NeighborhoodPOS
RmDir /REBOOTOK $PROGRAMFILES\NCR
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
# Set the context of $SMPROGRAMS and other shell folders. See also un.onInit below.
SetShellVarContext all
StrCpy $StartMenuGroup "$(^Name)"
FunctionEnd
# Uninstaller functions
Function un.onInit
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
# Set the context of $SMPROGRAMS and other shell folders. See also .onInit above.
SetShellVarContext all
StrCpy $StartMenuGroup "$(^Name)"
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd