Commit | Line | Data |
---|---|---|
09054f70 | 1 | ;libCEC installer |
d4954fb7 | 2 | ;Copyright (C) 2012 Pulse-Eight Ltd. |
09054f70 LOK |
3 | ;http://www.pulse-eight.com/ |
4 | ||
5 | !include "MUI2.nsh" | |
6 | !include "nsDialogs.nsh" | |
7 | !include "LogicLib.nsh" | |
8 | !include "x64.nsh" | |
9 | ||
8dfe215b | 10 | Name "Pulse-Eight USB-CEC Adapter" |
4d760b54 | 11 | OutFile "..\build\libCEC-installer.exe" |
09054f70 LOK |
12 | |
13 | XPStyle on | |
8dfe215b LOK |
14 | InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter" |
15 | InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter software" "" | |
09054f70 LOK |
16 | RequestExecutionLevel admin |
17 | Var StartMenuFolder | |
18 | ||
dfb08039 | 19 | !define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information." |
09054f70 LOK |
20 | !define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/" |
21 | !define MUI_ABORTWARNING | |
22 | ||
23 | !insertmacro MUI_PAGE_WELCOME | |
24 | !insertmacro MUI_PAGE_LICENSE "..\COPYING" | |
d4954fb7 | 25 | !insertmacro MUI_PAGE_COMPONENTS |
09054f70 LOK |
26 | !insertmacro MUI_PAGE_DIRECTORY |
27 | ||
8dfe215b LOK |
28 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" |
29 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter sofware" | |
09054f70 LOK |
30 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" |
31 | !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder | |
32 | ||
33 | !insertmacro MUI_PAGE_INSTFILES | |
34 | !insertmacro MUI_PAGE_FINISH | |
35 | ||
36 | !insertmacro MUI_UNPAGE_WELCOME | |
37 | !insertmacro MUI_UNPAGE_CONFIRM | |
38 | !insertmacro MUI_UNPAGE_INSTFILES | |
39 | !insertmacro MUI_UNPAGE_FINISH | |
40 | ||
41 | !insertmacro MUI_LANGUAGE "English" | |
42 | ||
d4954fb7 LOK |
43 | InstType "USB-CEC driver & libCEC" |
44 | InstType "USB-CEC driver only" | |
45 | InstType "Full installation" | |
09054f70 | 46 | |
d4954fb7 | 47 | Section "USB-CEC driver" SecDriver |
09054f70 LOK |
48 | SetShellVarContext current |
49 | SectionIn RO | |
d4954fb7 | 50 | SectionIn 1 2 3 |
4d760b54 | 51 | |
8dfe215b LOK |
52 | ; Uninstall the old unsigned software if it's found |
53 | ReadRegStr $1 HKCU "Software\libCEC" "" | |
54 | ${If} $1 != "" | |
55 | MessageBox MB_OK \ | |
56 | "A previous libCEC and USB-CEC driver was found. This update requires the old version to be uninstalled. Press OK to uninstall the old version." | |
57 | ExecWait '"$1\Uninstall.exe" /S _?=$1' | |
58 | Delete "$1\Uninstall.exe" | |
59 | RMDir "$1" | |
60 | ${EndIf} | |
61 | ||
4d760b54 | 62 | ; Copy to the installation directory |
09054f70 LOK |
63 | SetOutPath "$INSTDIR" |
64 | File "..\AUTHORS" | |
09054f70 | 65 | File "..\COPYING" |
f6562fae | 66 | |
8dfe215b | 67 | ; Copy the driver installer |
09054f70 | 68 | SetOutPath "$INSTDIR\driver" |
8dfe215b | 69 | File "..\build\p8-usbcec-driver-installer.exe" |
4d760b54 | 70 | |
09054f70 | 71 | ;Store installation folder |
8dfe215b | 72 | WriteRegStr HKLM "Software\Pulse-Eight\USB-CEC Adapter software" "" $INSTDIR |
09054f70 LOK |
73 | |
74 | ;Create uninstaller | |
75 | WriteUninstaller "$INSTDIR\Uninstall.exe" | |
76 | ||
77 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application | |
78 | SetOutPath "$INSTDIR" | |
79 | ||
80 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" | |
8dfe215b | 81 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk" "$INSTDIR\Uninstall.exe" \ |
09054f70 | 82 | "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \ |
8dfe215b | 83 | "" "Uninstall Pulse-Eight USB-CEC Adapter software." |
09054f70 LOK |
84 | |
85 | WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/" | |
86 | !insertmacro MUI_STARTMENU_WRITE_END | |
d4954fb7 | 87 | |
09054f70 | 88 | ;add entry to add/remove programs |
8dfe215b LOK |
89 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
90 | "DisplayName" "Pulse-Eight USB-CEC Adapter software" | |
91 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ | |
09054f70 | 92 | "UninstallString" "$INSTDIR\uninstall.exe" |
8dfe215b | 93 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
09054f70 | 94 | "NoModify" 1 |
8dfe215b | 95 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
09054f70 | 96 | "NoRepair" 1 |
8dfe215b | 97 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
09054f70 | 98 | "InstallLocation" "$INSTDIR" |
8dfe215b | 99 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
09054f70 | 100 | "DisplayIcon" "$INSTDIR\cec-client.exe,0" |
8dfe215b LOK |
101 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
102 | "Publisher" "Pulse-Eight Limited" | |
103 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ | |
09054f70 | 104 | "HelpLink" "http://www.pulse-eight.com/" |
8dfe215b | 105 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \ |
09054f70 LOK |
106 | "URLInfoAbout" "http://www.pulse-eight.com" |
107 | ||
108 | ;install driver | |
8dfe215b LOK |
109 | ExecWait '"$INSTDIR\driver\p8-usbcec-driver-installer.exe" /S' |
110 | Delete "$INSTDIR\driver\p8-usbcec-driver-installer.exe" | |
09054f70 LOK |
111 | SectionEnd |
112 | ||
d4954fb7 LOK |
113 | Section "libCEC" SecLibCec |
114 | SetShellVarContext current | |
115 | SectionIn 1 3 | |
116 | ||
117 | ; Copy to the installation directory | |
118 | SetOutPath "$INSTDIR" | |
119 | File "..\ChangeLog" | |
120 | File "..\README" | |
121 | File "..\build\*.dll" | |
122 | SetOutPath "$INSTDIR\x64" | |
123 | File /nonfatal "..\build\x64\*.dll" | |
124 | ||
125 | ; Copy to XBMC\system | |
126 | ReadRegStr $1 HKCU "Software\XBMC" "" | |
127 | ${If} $1 != "" | |
128 | SetOutPath "$1\system" | |
129 | File "..\build\libcec.dll" | |
130 | ${EndIf} | |
131 | ||
132 | ; Copy the headers | |
133 | SetOutPath "$INSTDIR\include" | |
134 | File /r /x *.so "..\include\cec*.*" | |
135 | ||
136 | ; Copy libcec.dll and libcec.x64.dll to the system directory | |
137 | SetOutPath "$SYSDIR" | |
138 | File "..\build\libcec.dll" | |
139 | ${If} ${RunningX64} | |
140 | File /nonfatal "..\build\x64\libcec.x64.dll" | |
141 | ${EndIf} | |
142 | SectionEnd | |
143 | ||
144 | Section "CEC debug client" SecCecClient | |
145 | SetShellVarContext current | |
146 | SectionIn 3 | |
147 | ||
148 | ; Copy to the installation directory | |
149 | SetOutPath "$INSTDIR" | |
10c03f2c | 150 | File /x p8-usbcec-driver-installer.exe /x cec-config-gui.exe "..\build\*.exe" |
d4954fb7 | 151 | SetOutPath "$INSTDIR\x64" |
10c03f2c | 152 | File /nonfatal /x cec-config-gui.exe "..\build\x64\*.exe" |
d4954fb7 LOK |
153 | |
154 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application | |
155 | SetOutPath "$INSTDIR" | |
156 | ||
157 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" | |
158 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \ | |
159 | "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \ | |
160 | "" "Start the CEC Test client." | |
161 | ${If} ${RunningX64} | |
162 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\x64\cec-client.x64.exe" \ | |
163 | "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \ | |
164 | "" "Start the CEC Test client (x64)." | |
165 | ${EndIf} | |
166 | !insertmacro MUI_STARTMENU_WRITE_END | |
167 | ||
168 | SectionEnd | |
169 | ||
10c03f2c LOK |
170 | Section "CEC configuration tool" SecCecConfig |
171 | SetShellVarContext current | |
172 | SectionIn 1 3 | |
173 | ||
174 | ; Copy to the installation directory | |
175 | SetOutPath "$INSTDIR" | |
176 | File "..\build\cec-config-gui.exe" | |
177 | SetOutPath "$INSTDIR\x64" | |
178 | File /nonfatal "..\build\x64\cec-config-gui.exe" | |
179 | ||
180 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application | |
181 | SetOutPath "$INSTDIR" | |
182 | ||
183 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" | |
184 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration.lnk" "$INSTDIR\cec-config-gui.exe" \ | |
185 | "" "$INSTDIR\cec-config-gui.exe" 0 SW_SHOWNORMAL \ | |
186 | "" "Start the CEC Adapter Configuration tool." | |
187 | ${If} ${RunningX64} | |
188 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration (x64).lnk" "$INSTDIR\x64\cec-config-gui.exe" \ | |
189 | "" "$INSTDIR\x64\cec-config-gui.exe" 0 SW_SHOWNORMAL \ | |
190 | "" "Start the CEC Adapter Configuration tool (x64)." | |
191 | ${EndIf} | |
192 | !insertmacro MUI_STARTMENU_WRITE_END | |
193 | ||
194 | SectionEnd | |
195 | ||
09054f70 LOK |
196 | ;-------------------------------- |
197 | ;Uninstaller Section | |
198 | ||
199 | Section "Uninstall" | |
200 | ||
201 | SetShellVarContext current | |
202 | ||
09054f70 | 203 | Delete "$INSTDIR\AUTHORS" |
10c03f2c | 204 | Delete "$INSTDIR\*.exe" |
09054f70 LOK |
205 | Delete "$INSTDIR\ChangeLog" |
206 | Delete "$INSTDIR\COPYING" | |
7879fa15 | 207 | Delete "$INSTDIR\*.dll" |
f00ff009 | 208 | Delete "$INSTDIR\*.lib" |
4d760b54 LOK |
209 | Delete "$INSTDIR\x64\*.dll" |
210 | Delete "$INSTDIR\x64\*.lib" | |
10c03f2c | 211 | Delete "$INSTDIR\x64\*.exe" |
09054f70 | 212 | Delete "$INSTDIR\README" |
8dfe215b LOK |
213 | |
214 | ; Uninstall the driver | |
215 | ReadRegStr $1 HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" "" | |
216 | ${If} $1 != "" | |
217 | ExecWait '"$1\Uninstall.exe" /S _?=$1' | |
218 | ${EndIf} | |
09054f70 LOK |
219 | |
220 | RMDir /r "$INSTDIR\include" | |
221 | Delete "$INSTDIR\Uninstall.exe" | |
222 | RMDir /r "$INSTDIR" | |
8dfe215b | 223 | RMDir "$PROGRAMFILES\Pulse-Eight" |
09054f70 LOK |
224 | |
225 | !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder | |
10c03f2c LOK |
226 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration.lnk" |
227 | ${If} ${RunningX64} | |
228 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Adapter Configuration (x64).lnk" | |
229 | ${EndIf} | |
09054f70 | 230 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" |
f00ff009 LOK |
231 | ${If} ${RunningX64} |
232 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" | |
233 | ${EndIf} | |
8dfe215b | 234 | Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk" |
09054f70 | 235 | Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" |
8dfe215b | 236 | RMDir "$SMPROGRAMS\$StartMenuFolder" |
09054f70 | 237 | |
8dfe215b LOK |
238 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" |
239 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" | |
240 | DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter software" | |
241 | DeleteRegKey /ifempty HKLM "Software\Pulse-Eight" | |
09054f70 | 242 | SectionEnd |