Imported Upstream version 2.2.0
[deb_libcec.git] / project / p8-usbcec-driver.nsi
CommitLineData
cbbe90dd
JB
1;p8-usbcec-driver installer
2;Copyright (C) 2011-2013 Pulse-Eight Ltd.
3;http://www.pulse-eight.com/
4
5!include "MUI2.nsh"
6!include "nsDialogs.nsh"
7!include "LogicLib.nsh"
8!include "x64.nsh"
9
10Name "Pulse-Eight USB-CEC Adapter"
11OutFile "..\build\p8-usbcec-driver-installer.exe"
12
13XPStyle on
14InstallDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter\driver"
15InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" ""
16RequestExecutionLevel admin
17
18!define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
19!define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
20!define MUI_ABORTWARNING
21
22!insertmacro MUI_PAGE_WELCOME
23!insertmacro MUI_PAGE_LICENSE "..\COPYING"
24!insertmacro MUI_PAGE_DIRECTORY
25
26!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
27!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Pulse-Eight\USB-CEC Adapter driver"
28
29!insertmacro MUI_PAGE_INSTFILES
30!insertmacro MUI_PAGE_FINISH
31
32!insertmacro MUI_UNPAGE_WELCOME
33!insertmacro MUI_UNPAGE_CONFIRM
34!insertmacro MUI_UNPAGE_INSTFILES
35!insertmacro MUI_UNPAGE_FINISH
36
37!insertmacro MUI_LANGUAGE "English"
38
39InstType "USB-CEC driver only"
40
41Section "USB-CEC driver" SecDriver
42 SetShellVarContext current
43 SectionIn RO
44 SectionIn 1
45
46 ; Copy to the installation directory
47 SetOutPath "$INSTDIR"
48 File "..\AUTHORS"
49 File "..\COPYING"
50
51 ; Copy the driver installer and .inf file
52 File "..\build\dpinst-amd64.exe"
53 File "..\build\dpinst-x86.exe"
54 File "..\driver\p8usb-cec.inf"
55 File "..\driver\p8usb-cec.cat"
56
57 ;Store installation folder
58 WriteRegStr HKLM "Software\Pulse-Eight\USB-CEC Adapter driver" "" $INSTDIR
59
60 ;Create uninstaller
61 WriteUninstaller "$INSTDIR\Uninstall.exe"
62
63 ;add entry to add/remove programs
64 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
65 "DisplayName" "Pulse-Eight USB-CEC Adapter driver"
66 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
67 "UninstallString" "$INSTDIR\uninstall.exe"
68 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
69 "NoModify" 1
70 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
71 "NoRepair" 1
72 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
73 "InstallLocation" "$INSTDIR"
74 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
75 "Publisher" "Pulse-Eight Limited"
76 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
77 "HelpLink" "http://www.pulse-eight.com/"
78 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver" \
79 "URLInfoAbout" "http://www.pulse-eight.com"
80
81 ;install driver
82 ${If} ${RunningX64}
83 ExecWait '"$INSTDIR\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR"'
84 ${Else}
85 ExecWait '"$INSTDIR\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR"'
86 ${EndIf}
87SectionEnd
88
89;--------------------------------
90;Uninstaller Section
91
92Section "Uninstall"
93
94 SetShellVarContext current
95
96 ${If} ${RunningX64}
97 ExecWait '"$INSTDIR\dpinst-amd64.exe" /u "$INSTDIR\p8usb-cec.inf"'
98 ${Else}
99 ExecWait '"$INSTDIR\dpinst-x64.exe" /u "$INSTDIR\p8usb-cec.inf"'
100 ${EndIf}
101 Delete "$INSTDIR\AUTHORS"
102 Delete "$INSTDIR\COPYING"
103 Delete "$INSTDIR\p8usb-cec.inf"
104 Delete "$INSTDIR\p8usb-cec.cat"
105 Delete "$INSTDIR\dpinst-amd64.exe"
106 Delete "$INSTDIR\dpinst-x86.exe"
107
108 RMDir /r "$INSTDIR\include"
109 Delete "$INSTDIR\Uninstall.exe"
110 RMDir /r "$INSTDIR"
111 RMDir "$PROGRAMFILES\Pulse-Eight\USB-CEC Adapter"
112 RMDir "$PROGRAMFILES\Pulse-Eight"
113
114 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Pulse-Eight USB-CEC Adapter driver"
115 DeleteRegKey /ifempty HKLM "Software\Pulse-Eight\USB-CEC Adapter driver"
116 DeleteRegKey /ifempty HKLM "Software\Pulse-Eight"
117
118SectionEnd