2 ;Copyright (C) 2012 Pulse-Eight Ltd.
3 ;http://www.pulse-eight.com/
6 !include "nsDialogs.nsh"
7 !include "LogicLib.nsh"
10 Name "Pulse-Eight USB-CEC Adapter"
11 OutFile "..\build\libCEC-installer.exe"
14 InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter"
15 InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter software" ""
16 RequestExecutionLevel admin
19 !define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
20 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
21 !define MUI_ABORTWARNING
23 !insertmacro MUI_PAGE_WELCOME
24 !insertmacro MUI_PAGE_LICENSE "..\COPYING"
25 !insertmacro MUI_PAGE_COMPONENTS
26 !insertmacro MUI_PAGE_DIRECTORY
28 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
29 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter sofware"
30 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
31 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
33 !insertmacro MUI_PAGE_INSTFILES
34 !insertmacro MUI_PAGE_FINISH
36 !insertmacro MUI_UNPAGE_WELCOME
37 !insertmacro MUI_UNPAGE_CONFIRM
38 !insertmacro MUI_UNPAGE_INSTFILES
39 !insertmacro MUI_UNPAGE_FINISH
41 !insertmacro MUI_LANGUAGE "English"
43 InstType "USB-CEC driver & libCEC"
44 InstType "USB-CEC driver only"
45 InstType "Full installation"
47 Section "USB-CEC driver" SecDriver
48 SetShellVarContext current
52 ; Uninstall the old unsigned software if it's found
53 ReadRegStr $1 HKCU "Software\libCEC" ""
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"
62 ; Copy to the installation directory
67 ; Copy the driver installer
68 SetOutPath "$INSTDIR\driver"
69 File "..\build\p8-usbcec-driver-installer.exe"
71 ;Store installation folder
72 WriteRegStr HKLM "Software\Pulse-Eight\USB-CEC Adapter software" "" $INSTDIR
75 WriteUninstaller "$INSTDIR\Uninstall.exe"
77 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
80 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
81 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk" "$INSTDIR\Uninstall.exe" \
82 "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \
83 "" "Uninstall Pulse-Eight USB-CEC Adapter software."
85 WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/"
86 !insertmacro MUI_STARTMENU_WRITE_END
88 ;add entry to add/remove programs
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" \
92 "UninstallString" "$INSTDIR\uninstall.exe"
93 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
95 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
97 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
98 "InstallLocation" "$INSTDIR"
99 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
100 "DisplayIcon" "$INSTDIR\cec-client.exe,0"
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" \
104 "HelpLink" "http://www.pulse-eight.com/"
105 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware" \
106 "URLInfoAbout" "http://www.pulse-eight.com"
109 ExecWait '"$INSTDIR\driver\p8-usbcec-driver-installer.exe" /S'
110 Delete "$INSTDIR\driver\p8-usbcec-driver-installer.exe"
113 Section "libCEC" SecLibCec
114 SetShellVarContext current
117 ; Copy to the installation directory
118 SetOutPath "$INSTDIR"
121 File "..\build\*.dll"
122 SetOutPath "$INSTDIR\x64"
123 File /nonfatal "..\build\x64\*.dll"
125 ; Copy to XBMC\system
126 ReadRegStr $1 HKCU "Software\XBMC" ""
128 SetOutPath "$1\system"
129 File "..\build\libcec.dll"
133 SetOutPath "$INSTDIR\include"
134 File /r /x *.so "..\include\cec*.*"
136 ; Copy libcec.dll and libcec.x64.dll to the system directory
138 File "..\build\libcec.dll"
140 File /nonfatal "..\build\x64\libcec.x64.dll"
144 Section "CEC debug client" SecCecClient
145 SetShellVarContext current
148 ; Copy to the installation directory
149 SetOutPath "$INSTDIR"
150 File /x p8-usbcec-driver-installer.exe "..\build\*.exe"
151 SetOutPath "$INSTDIR\x64"
152 File /nonfatal "..\build\x64\*.exe"
154 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
155 SetOutPath "$INSTDIR"
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."
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)."
166 !insertmacro MUI_STARTMENU_WRITE_END
170 ;--------------------------------
175 SetShellVarContext current
177 Delete "$INSTDIR\AUTHORS"
178 Delete "$INSTDIR\cec*.exe"
179 Delete "$INSTDIR\ChangeLog"
180 Delete "$INSTDIR\COPYING"
181 Delete "$INSTDIR\*.dll"
182 Delete "$INSTDIR\*.lib"
183 Delete "$INSTDIR\x64\*.dll"
184 Delete "$INSTDIR\x64\*.lib"
185 Delete "$INSTDIR\README"
187 ; Uninstall the driver
188 ReadRegStr $1 HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" ""
190 ExecWait '"$1\Uninstall.exe" /S _?=$1'
193 RMDir /r "$INSTDIR\include"
194 Delete "$INSTDIR\Uninstall.exe"
196 RMDir "$PROGRAMFILES\Pulse-Eight"
198 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
199 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk"
201 Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk"
203 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Pulse-Eight USB-CEC Adapter software.lnk"
204 Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url"
205 RMDir "$SMPROGRAMS\$StartMenuFolder"
207 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter sofware"
208 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver"
209 DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter software"
210 DeleteRegKey /ifempty HKLM "Software\Pulse-Eight"