forked from adafruit/Adafruit_Windows_Drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adafruit_drivers.nsi
134 lines (112 loc) · 4.98 KB
/
adafruit_drivers.nsi
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
# Adafruit Board Driver NSIS Install Script
# Author: Tony DiCola
# Import some useful functions.
!include WinVer.nsh # Windows version detection.
!include x64.nsh # X86/X64 version detection.
!define VERSION 2.3.4.0
# Set attributes that describe the installer.
Icon "Assets\adafruit.ico"
Caption "Adafruit Board Drivers"
Name "Adafruit board drivers"
Outfile "adafruit_drivers_${VERSION}.exe"
ManifestSupportedOS "all"
SpaceTexts "none"
# Install driver files to a temporary location (then dpinst will handle the real install).
InstallDir "$TEMP\adafruit_drivers"
# Set properties on the installer exe that will be generated.
VIAddVersionKey /LANG=1033 "ProductName" "Adafruit Board Drivers"
VIAddVersionKey /LANG=1033 "CompanyName" "Adafruit Industries"
VIAddVersionKey /LANG=1033 "LegalCopyright" "Adafruit Industries"
VIAddVersionKey /LANG=1033 "FileDescription" "All in one installer for Adafruit's board drivers."
VIAddVersionKey /LANG=1033 "FileVersion" "2.3.4.0"
VIProductVersion ${VERSION}
VIFileVersion ${VERSION}
# Define variables used in sections.
Var dpinst # Will hold the path and name of dpinst being used (x86 or x64).
# Define the standard pages in the installer.
# License page shows the contents of license.rtf.
PageEx license
LicenseData "license.rtf"
PageExEnd
# Components page allows user to pick the drivers to install.
PageEx components
ComponentText "Check the board drivers below that you would like to install. Click install to start the installation." \
"" "Select board drivers to install:"
PageExEnd
# Instfiles page does the actual installation.
Page instfiles
# Sections define the components (drivers) that can be installed.
# The section name is displayed in the component select screen and if selected
# the code in the section will be executed during the install.
# Note that /o before the name makes the section optional and not selected by default.
# This first section is hidden and always selected so it runs first and bootstraps
# the install by copying all the files and dpinst to the temp folder location.
Section
# Copy all the drivers and dpinst exes to the temp location.
SetOutPath $INSTDIR
File /r "Drivers"
File "dpinst-x64.exe"
File "dpinst-x86.exe"
# Set dpinst variable based on the current OS type (x86/x64).
${If} ${RunningX64}
StrCpy $dpinst "$INSTDIR\dpinst-x64.exe"
${Else}
StrCpy $dpinst "$INSTDIR\dpinst-x86.exe"
${EndIf}
SectionEnd
Section "Feather 32u4, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground, CircuitPlayground Express, Gemma M0, Trinket M0, Itsy Bitsy 32u4 and M0, pIRKey M0, HalloWing M0 Express, Flora, Bluefruit Micro" USBSER_BOARDS
# Use dpinst to install the driver.
# Note the following options are specified:
# /sw = silent mode, hide the installer but NOT the OS prompts (critical!)
# /path = path to directory with driver data
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\Adafruit_usbser"'
SectionEnd
Section "Feather WICED"
# Install all three drivers (each _must_ be in its own directory or
# dpinst will silently fail!).
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\Adafruit_Feather_WICED"'
# Don't install CDC driver on Windows 10, but do install the other drivers for WICED.
${IfNot} ${AtLeastWin10}
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\Adafruit_Feather_WICED_CDC"'
${EndIf}
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\Adafruit_Feather_WICED_DFU"'
SectionEnd
Section "Trinket / Pro Trinket / Gemma (USBtinyISP)"
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\USBtinyISP"'
SectionEnd
Section /o "Arduino Gemma" ARDUINO_GEMMA
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\Arduino_Gemma"'
SectionEnd
Section /o "Feather HUZZAH ESP8266 (SiLabs CP210x)"
${If} ${AtMostWinVista}
# Use older driver for XP & Vista.
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\SiLabs_CP210x\WinVista"'
${Else}
# User newer driver for 7 and beyond.
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\SiLabs_CP210x\Win7"'
${EndIf}
SectionEnd
Section /o "Metro 328 / Metro Mini 328 (FTDI VCP and CP210X)"
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\FTDI_VCP_PORT"'
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\FTDI_VCP_BUS"'
${If} ${AtMostWinVista}
# Use older driver for XP & Vista.
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\SiLabs_CP210x\WinVista"'
${Else}
# User newer driver for 7 and beyond.
ExecWait '"$dpinst" /sw /path "$INSTDIR\Drivers\SiLabs_CP210x\Win7"'
${EndIf}
SectionEnd
# Unselect, disable, and hide the given section.
!macro HideSectionMacro SectionId
SectionSetFlags ${SectionId} ${SF_RO}
SectionSetText ${SectionId} ""
!macroend
!define HideSection '!insertMacro HideSectionMacro'
Function .onInit
# Hide all drivers that aren't needed in Windows 10.
${If} ${AtLeastWin10}
${HideSection} ${USBSER_BOARDS}
${HideSection} ${ARDUINO_GEMMA}
${EndIf}
FunctionEnd