Commit | Line | Data |
---|---|---|
09054f70 LOK |
1 | ;libCEC installer |
2 | ;Copyright (C) 2011 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 | ||
10 | Name "libCEC" | |
4d760b54 | 11 | OutFile "..\build\libCEC-installer.exe" |
09054f70 LOK |
12 | |
13 | XPStyle on | |
14 | InstallDir "$PROGRAMFILES\libCEC" | |
15 | InstallDirRegKey HKCU "Software\libCEC" "" | |
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" | |
25 | !insertmacro MUI_PAGE_DIRECTORY | |
26 | ||
27 | !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" | |
28 | !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\libCEC" | |
29 | !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" | |
30 | !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder | |
31 | ||
32 | !insertmacro MUI_PAGE_INSTFILES | |
33 | !insertmacro MUI_PAGE_FINISH | |
34 | ||
35 | !insertmacro MUI_UNPAGE_WELCOME | |
36 | !insertmacro MUI_UNPAGE_CONFIRM | |
37 | !insertmacro MUI_UNPAGE_INSTFILES | |
38 | !insertmacro MUI_UNPAGE_FINISH | |
39 | ||
40 | !insertmacro MUI_LANGUAGE "English" | |
41 | ||
42 | InstType "Full" | |
43 | ||
44 | Section "libCEC" SecLibCEC | |
45 | SetShellVarContext current | |
46 | SectionIn RO | |
47 | SectionIn 1 #section is in installtype Full | |
4d760b54 LOK |
48 | |
49 | ; Copy to the installation directory | |
09054f70 LOK |
50 | SetOutPath "$INSTDIR" |
51 | File "..\AUTHORS" | |
4d760b54 | 52 | File /x dpinst*.exe "..\build\*.exe" |
09054f70 LOK |
53 | File "..\ChangeLog" |
54 | File "..\COPYING" | |
09054f70 | 55 | File "..\README" |
4d760b54 LOK |
56 | File "..\build\*.dll" |
57 | SetOutPath "$INSTDIR\x64" | |
58 | File /nonfatal "..\build\x64\*" | |
09054f70 | 59 | |
f6562fae B |
60 | ; Copy to XBMC\system |
61 | ReadRegStr $1 HKCU "Software\XBMC" "" | |
62 | ${If} $1 != "" | |
63 | SetOutPath "$1\system" | |
4d760b54 | 64 | File "..\build\libcec.dll" |
f6562fae B |
65 | ${EndIf} |
66 | ||
4d760b54 | 67 | ; Copy the driver installer and .inf file |
09054f70 | 68 | SetOutPath "$INSTDIR\driver" |
4d760b54 LOK |
69 | File "..\build\dpinst-amd64.exe" |
70 | File "..\build\dpinst-x86.exe" | |
61e91a48 LOK |
71 | File "..\driver\p8usb-cec.inf" |
72 | File "..\driver\p8usb-cec.cat" | |
4d760b54 LOK |
73 | |
74 | ; Copy the headers | |
09054f70 | 75 | SetOutPath "$INSTDIR\include" |
465ab2f1 | 76 | File /r /x *.so "..\include\cec*.*" |
09054f70 | 77 | |
4d760b54 LOK |
78 | ; Copy libcec.dll and libcec.x64.dll to the system directory |
79 | SetOutPath "$SYSDIR" | |
80 | File "..\build\libcec.dll" | |
81 | ${If} ${RunningX64} | |
82 | File /nonfatal "..\build\x64\libcec.x64.dll" | |
83 | ${EndIf} | |
84 | ||
09054f70 LOK |
85 | ;Store installation folder |
86 | WriteRegStr HKCU "Software\libCEC" "" $INSTDIR | |
87 | ||
88 | ;Create uninstaller | |
89 | WriteUninstaller "$INSTDIR\Uninstall.exe" | |
90 | ||
91 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application | |
92 | SetOutPath "$INSTDIR" | |
93 | ||
94 | CreateDirectory "$SMPROGRAMS\$StartMenuFolder" | |
95 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" "$INSTDIR\cec-client.exe" \ | |
96 | "" "$INSTDIR\cec-client.exe" 0 SW_SHOWNORMAL \ | |
97 | "" "Start the CEC Test client." | |
f00ff009 | 98 | ${If} ${RunningX64} |
4d760b54 | 99 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" "$INSTDIR\x64\cec-client.x64.exe" \ |
f00ff009 LOK |
100 | "" "$INSTDIR\cec-client.x64.exe" 0 SW_SHOWNORMAL \ |
101 | "" "Start the CEC Test client (x64)." | |
102 | ${EndIf} | |
09054f70 LOK |
103 | CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" "$INSTDIR\Uninstall.exe" \ |
104 | "" "$INSTDIR\Uninstall.exe" 0 SW_SHOWNORMAL \ | |
105 | "" "Uninstall libCEC." | |
106 | ||
107 | WriteINIStr "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" "InternetShortcut" "URL" "http://www.pulse-eight.com/" | |
108 | !insertmacro MUI_STARTMENU_WRITE_END | |
109 | ||
110 | ||
111 | ;add entry to add/remove programs | |
112 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
113 | "DisplayName" "libCEC" | |
114 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
115 | "UninstallString" "$INSTDIR\uninstall.exe" | |
116 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
117 | "NoModify" 1 | |
118 | WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
119 | "NoRepair" 1 | |
120 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
121 | "InstallLocation" "$INSTDIR" | |
122 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
123 | "DisplayIcon" "$INSTDIR\cec-client.exe,0" | |
124 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
125 | "Publisher" "Pulse-Eight Ltd." | |
126 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
127 | "HelpLink" "http://www.pulse-eight.com/" | |
128 | WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" \ | |
129 | "URLInfoAbout" "http://www.pulse-eight.com" | |
130 | ||
131 | ;install driver | |
132 | ${If} ${RunningX64} | |
133 | ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /lm /sa /sw /PATH "$INSTDIR\driver"' | |
134 | ${Else} | |
135 | ExecWait '"$INSTDIR\driver\dpinst-x86.exe" /lm /sa /sw /PATH "$INSTDIR\driver"' | |
136 | ${EndIf} | |
137 | SectionEnd | |
138 | ||
139 | ;-------------------------------- | |
140 | ;Uninstaller Section | |
141 | ||
142 | Section "Uninstall" | |
143 | ||
144 | SetShellVarContext current | |
145 | ||
146 | ${If} ${RunningX64} | |
61e91a48 | 147 | ExecWait '"$INSTDIR\driver\dpinst-amd64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"' |
09054f70 | 148 | ${Else} |
61e91a48 | 149 | ExecWait '"$INSTDIR\driver\dpinst-x64.exe" /u "$INSTDIR\driver\p8usb-cec.inf"' |
09054f70 LOK |
150 | ${EndIf} |
151 | Delete "$INSTDIR\AUTHORS" | |
f00ff009 | 152 | Delete "$INSTDIR\cec*.exe" |
09054f70 LOK |
153 | Delete "$INSTDIR\ChangeLog" |
154 | Delete "$INSTDIR\COPYING" | |
7879fa15 | 155 | Delete "$INSTDIR\*.dll" |
f00ff009 | 156 | Delete "$INSTDIR\*.lib" |
4d760b54 LOK |
157 | Delete "$INSTDIR\x64\*.dll" |
158 | Delete "$INSTDIR\x64\*.lib" | |
09054f70 | 159 | Delete "$INSTDIR\README" |
61e91a48 LOK |
160 | Delete "$INSTDIR\driver\p8usb-cec.inf" |
161 | Delete "$INSTDIR\driver\p8usb-cec.cat" | |
09054f70 LOK |
162 | Delete "$INSTDIR\driver\dpinst-amd64.exe" |
163 | Delete "$INSTDIR\driver\dpinst-x86.exe" | |
164 | ||
165 | RMDir /r "$INSTDIR\include" | |
166 | Delete "$INSTDIR\Uninstall.exe" | |
167 | RMDir /r "$INSTDIR" | |
168 | ||
169 | !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder | |
170 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client.lnk" | |
f00ff009 LOK |
171 | ${If} ${RunningX64} |
172 | Delete "$SMPROGRAMS\$StartMenuFolder\CEC Test client (x64).lnk" | |
173 | ${EndIf} | |
09054f70 LOK |
174 | Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall libCEC.lnk" |
175 | Delete "$SMPROGRAMS\$StartMenuFolder\Visit Pulse-Eight.url" | |
176 | RMDir "$SMPROGRAMS\$StartMenuFolder" | |
177 | ||
178 | DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\libCEC" | |
179 | ||
180 | DeleteRegKey /ifempty HKCU "Software\libCEC" | |
181 | ||
182 | SectionEnd |