install_script.nsi
5.28 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
!include "x64.nsh"
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "Raspberry Pi USB boot"
OutFile "rpiboot_setup.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Raspberry Pi"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Raspberry Pi" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
ShowInstDetails show
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_ABORTWARNING
!define MUI_ICON "Raspberry_Pi_Logo.ico"
!define MUI_UNICON "Raspberry_Pi_Logo.ico"
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Initialisation functions
Function .onInit
ReadRegStr $R0 HKCU "Software\Compute Module Boot" ""
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"'Compute Module Boot' is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
; Remove the left over usb_driver directory
RmDir /r /REBOOTOK $R0\usb_driver
ExecWait '$R0\Uninstall.exe _?=$R0'
IfErrors no_remove_uninstaller done
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
RmDir /r /REBOOTOK $R0
FunctionEnd
;--------------------------------
;Installer Sections
Section "Raspberry Pi USB Boot" Sec_rpiboot
SetOutPath "$INSTDIR"
File /r redist
SetOutPath "$INSTDIR\msd"
File /r /x bootcode4.bin ..\msd\*.*
File ..\bootcode4.bin
SetOutPath "$INSTDIR\recovery"
File /r /x bootcode4.bin ..\recovery\*.*
File /oname=bootcode4.bin ..\recovery.bin
SetOutPath "$INSTDIR\mass-storage-gadget"
File /r /x bootcode4.bin ..\mass-storage-gadget\*.*
File ..\bootcode4.bin
SetOutPath "$INSTDIR\rpi-imager-embedded"
File /r /x bootcode4.bin ..\rpi-imager-embedded\*.*
File ..\bootcode4.bin
SetOutPath "$INSTDIR\secure-boot-example"
File /r /x bootcode4.bin ..\secure-boot-example\*.*
File ..\bootcode4.bin
SetOutPath "$INSTDIR\secure-boot-msd"
File /r /x bootcode4.bin ..\secure-boot-msd\*.*
File ..\bootcode4.bin
SetOutPath "$INSTDIR\secure-boot-recovery"
File /r /x bootcode4.bin ..\secure-boot-recovery\*.*
File /oname=bootcode4.bin ..\recovery.bin
SetOutPath "$INSTDIR\tools"
File /r ..\tools\*.*
SetOutPath "$INSTDIR"
DetailPrint "Installing BCM2708 driver..."
ExecWait '"$INSTDIR\redist\wdi-simple.exe" -n "Raspberry Pi USB boot" -v 0x0a5c -p 0x2763 -t 0' $0
DetailPrint "Driver install returned $0"
DetailPrint "Installing BCM2710 driver..."
ExecWait '"$INSTDIR\redist\wdi-simple.exe" -n "Raspberry Pi USB boot" -v 0x0a5c -p 0x2764 -t 0' $0
DetailPrint "Driver install returned $0"
DetailPrint "Installing BCM2711 driver..."
ExecWait '"$INSTDIR\redist\wdi-simple.exe" -n "Raspberry Pi USB boot" -v 0x0a5c -p 0x2711 -t 0' $0
DetailPrint "Driver install returned $0"
File cyggcc_s-1.dll
File cygusb-1.0.dll
File cygwin1.dll
File ..\rpiboot.exe
CreateDirectory "$SMPROGRAMS\Raspberry Pi"
CreateShortcut "$SMPROGRAMS\Raspberry Pi\rpiboot.lnk" "$INSTDIR\rpiboot.exe"
CreateShortcut "$SMPROGRAMS\Raspberry Pi\Uninstall rpiboot.lnk" "$INSTDIR\Uninstall.exe"
;Store installation folder
WriteRegStr HKCU "Software\Raspberry Pi" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "Install drivers for flashing Compute Module."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Sec_rpiboot} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
RmDir /r /REBOOTOK $INSTDIR\redist
RmDir /r /REBOOTOK $INSTDIR\mass-storage-gadget
RmDir /r /REBOOTOK $INSTDIR\msd
RmDir /r /REBOOTOK $INSTDIR\recovery
RmDir /r /REBOOTOK $INSTDIR\rpi-imager-embedded
RmDir /r /REBOOTOK $INSTDIR\secure-boot-example
RmDir /r /REBOOTOK $INSTDIR\secure-boot-msd
RmDir /r /REBOOTOK $INSTDIR\secure-boot-recovery
RmDir /r /REBOOTOK $INSTDIR\tools
RmDir /r /REBOOTOK $INSTDIR\usb_driver
Delete $INSTDIR\Uninstall.exe
Delete $INSTDIR\cyggcc_s-1.dll
Delete $INSTDIR\cygusb-1.0.dll
Delete $INSTDIR\cygwin1.dll
Delete $INSTDIR\rpiboot.exe
RmDir /REBOOTOK $INSTDIR
RmDir /r "$SMPROGRAMS\Raspberry Pi"
DeleteRegKey /ifempty HKCU "Software\Raspberry Pi"
SectionEnd