-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b770590
commit c0e0d98
Showing
18 changed files
with
1,313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
# but don't forget to also ignore us | ||
.DS_Store* | ||
.env | ||
installer/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.swp | ||
ParticleCLISetup.exe | ||
Thumbs.db | ||
*.p12 | ||
ParticleDriversSetup.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
; GetWindowsVersion 4.1.1 (2015-06-22) | ||
; http://nsis.sourceforge.net/Get_Windows_version | ||
; | ||
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ | ||
; Update by Joost Verburg | ||
; Update (Macro, Define, Windows 7 detection) - John T. Haller of PortableApps.com - 2008-01-07 | ||
; Update (Windows 8 detection) - Marek Mizanin (Zanir) - 2013-02-07 | ||
; Update (Windows 8.1 detection) - John T. Haller of PortableApps.com - 2014-04-04 | ||
; Update (Windows 10 TP detection) - John T. Haller of PortableApps.com - 2014-10-01 | ||
; Update (Windows 10 TP4 detection, and added include guards) - Kairu - 2015-06-22 | ||
; | ||
; Usage: ${GetWindowsVersion} $R0 | ||
; | ||
; $R0 contains: 95, 98, ME, NT x.x, 2000, XP, 2003, Vista, 7, 8, 8.1, 10.0 or '' (for unknown) | ||
|
||
!ifndef __GET_WINDOWS_VERSION_NSH | ||
!define __GET_WINDOWS_VERSION_NSH | ||
|
||
!macro DefineGetWindowsVersion un | ||
Function ${un}GetWindowsVersion | ||
|
||
Push $R0 | ||
Push $R1 | ||
Push $R2 | ||
Push $R3 | ||
|
||
ClearErrors | ||
|
||
; check if Windows NT family | ||
ReadRegStr $R0 HKLM \ | ||
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion | ||
|
||
IfErrors 0 lbl_winnt | ||
|
||
; we are not NT | ||
ReadRegStr $R0 HKLM \ | ||
"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber | ||
|
||
StrCpy $R1 $R0 1 | ||
StrCmp $R1 '4' 0 lbl_error | ||
|
||
StrCpy $R1 $R0 3 | ||
|
||
StrCmp $R1 '4.0' lbl_win32_95 | ||
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 | ||
|
||
lbl_win32_95: | ||
StrCpy $R0 '95' | ||
Goto lbl_done | ||
|
||
lbl_win32_98: | ||
StrCpy $R0 '98' | ||
Goto lbl_done | ||
|
||
lbl_win32_ME: | ||
StrCpy $R0 'ME' | ||
Goto lbl_done | ||
|
||
lbl_winnt: | ||
|
||
StrCpy $R1 $R0 1 | ||
|
||
StrCmp $R1 '3' lbl_winnt_x | ||
StrCmp $R1 '4' lbl_winnt_x | ||
|
||
StrCpy $R1 $R0 3 | ||
|
||
StrCmp $R1 '5.0' lbl_winnt_2000 | ||
StrCmp $R1 '5.1' lbl_winnt_XP | ||
StrCmp $R1 '5.2' lbl_winnt_2003 | ||
StrCmp $R1 '6.0' lbl_winnt_vista | ||
StrCmp $R1 '6.1' lbl_winnt_7 | ||
StrCmp $R1 '6.2' lbl_winnt_8 | ||
|
||
Goto lbl_winnt_latest | ||
|
||
lbl_winnt_x: | ||
StrCpy $R0 "NT $R0" 6 | ||
Goto lbl_done | ||
|
||
lbl_winnt_2000: | ||
Strcpy $R0 '2000' | ||
Goto lbl_done | ||
|
||
lbl_winnt_XP: | ||
Strcpy $R0 'XP' | ||
Goto lbl_done | ||
|
||
lbl_winnt_2003: | ||
Strcpy $R0 '2003' | ||
Goto lbl_done | ||
|
||
lbl_winnt_vista: | ||
Strcpy $R0 'Vista' | ||
Goto lbl_done | ||
|
||
lbl_winnt_7: | ||
Strcpy $R0 '7' | ||
Goto lbl_done | ||
|
||
lbl_winnt_8: | ||
Strcpy $R0 '8' | ||
Goto lbl_done | ||
|
||
lbl_winnt_81: | ||
Strcpy $R0 '8.1' | ||
Goto lbl_done | ||
|
||
lbl_winnt_latest: | ||
ReadRegStr $R2 HKLM \ | ||
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentMajorVersionNumber | ||
ReadRegStr $R3 HKLM \ | ||
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentMinorVersionNumber | ||
StrCpy $R0 "$R2.$R3" | ||
StrCmp $R0 "" lbl_winnt_81 | ||
Goto lbl_done | ||
|
||
lbl_error: | ||
Strcpy $R0 '' | ||
|
||
lbl_done: | ||
Pop $R3 | ||
Pop $R2 | ||
Pop $R1 | ||
Exch $R0 | ||
|
||
FunctionEnd | ||
!macroend | ||
|
||
; Make GetWindowsVersion available for installer and uninstaller | ||
!insertmacro DefineGetWindowsVersion "" | ||
!insertmacro DefineGetWindowsVersion "un." | ||
|
||
!macro GetWindowsVersion OUTPUT_VALUE | ||
!ifdef __UNINSTALL__ | ||
Call un.GetWindowsVersion | ||
!else | ||
Call GetWindowsVersion | ||
!endif | ||
Pop `${OUTPUT_VALUE}` | ||
!macroend | ||
|
||
!define GetWindowsVersion '!insertmacro "GetWindowsVersion"' | ||
|
||
!endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
; Particle CLI installer script | ||
|
||
;-------------------------------- | ||
; General | ||
|
||
; Name and file | ||
!define PRODUCT_NAME "Particle CLI" | ||
!define SHORT_NAME "ParticleCLI" | ||
Name "${PRODUCT_NAME}" | ||
OutFile "ParticleCLISetup.exe" | ||
!define COMPANY_NAME "Particle Industries, Inc" | ||
!define MUI_ICON "assets\particle.ico" | ||
|
||
; Installation directory | ||
InstallDir "$LOCALAPPDATA\particle" | ||
!define BINDIR "$INSTDIR\bin" | ||
|
||
|
||
; CLI Executable | ||
!define EXE "particle.exe" | ||
|
||
; OpenSSL installer | ||
!addplugindir /x86-ansi Plugins/x86-ansi | ||
!define OpenSSLFile "Win32OpenSSL_Light-1_1_0d.exe" | ||
|
||
; Don't request admin privileges | ||
RequestExecutionLevel user | ||
|
||
; Show command line with details of the installation | ||
ShowInstDetails show | ||
|
||
; Registry Entry for environment | ||
; All users: | ||
;!define Environ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' | ||
; Current user only: | ||
!define Environ 'HKCU "Environment"' | ||
|
||
; Registry entry for uninstaller | ||
!define UNINSTALL_REG 'HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}"' | ||
|
||
; Text to display when the installation is done | ||
CompletedText 'Run "particle login" in the command line to start using the Particle CLI' | ||
|
||
|
||
;-------------------------------- | ||
; Dependencies | ||
|
||
; Add JSON and download plugins | ||
; Modern UI | ||
!include "MUI2.nsh" | ||
; Architecture detection | ||
!include "x64.nsh" | ||
!include "TextFunc.nsh" | ||
!include "LogicLib.nsh" | ||
|
||
!include "utils.nsh" | ||
|
||
; Don't show a certain operation in the details | ||
!macro EchoOff | ||
SetDetailsPrint none | ||
!macroend | ||
!macro EchoOn | ||
SetDetailsPrint both | ||
!macroend | ||
!define EchoOff "!insertmacro EchoOff" | ||
!define EchoOn "!insertmacro EchoOn" | ||
|
||
;-------------------------------- | ||
; Installer pages | ||
|
||
; Welcome page | ||
!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\particle.bmp" | ||
!define MUI_WELCOMEPAGE_TITLE "Install the ${PRODUCT_NAME}" | ||
!define /file MUI_WELCOMEPAGE_TEXT "welcome.txt" | ||
|
||
!insertmacro MUI_PAGE_WELCOME | ||
|
||
; Open source licenses | ||
!insertmacro MUI_PAGE_LICENSE "licenses.txt" | ||
|
||
; Select what to install | ||
InstType "Full" | ||
!insertmacro MUI_PAGE_COMPONENTS | ||
|
||
; Installation details page | ||
!insertmacro MUI_PAGE_INSTFILES | ||
|
||
; Finish page | ||
!define MUI_FINISHPAGE_SHOWREADME "" | ||
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Enable automatic updates" | ||
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION EnableAutoUpdates | ||
!insertmacro MUI_PAGE_FINISH | ||
|
||
; Uninstall confirm page | ||
!insertmacro MUI_UNPAGE_CONFIRM | ||
; Uninstallation details page | ||
!insertmacro MUI_UNPAGE_INSTFILES | ||
!insertmacro MUI_LANGUAGE "English" | ||
|
||
;-------------------------------- | ||
; Installer Sections | ||
|
||
Section "CLI" CLI_SECTION | ||
SectionIn 1 3 | ||
SetOutPath $INSTDIR | ||
Call CopyExecutables | ||
Call DisableAutoUpdates | ||
Call AddCLIToPath | ||
SectionEnd | ||
|
||
Section "OpenSSL (keys tools)" OPENSSL_SECTION | ||
SectionIn 1 3 | ||
Call InstallOpenSSL | ||
SectionEnd | ||
|
||
Section "-Create uninstaller" | ||
WriteRegStr ${UNINSTALL_REG} "DisplayName" "${PRODUCT_NAME}" | ||
WriteRegStr ${UNINSTALL_REG} "Publisher" "${COMPANY_NAME}" | ||
WriteRegStr ${UNINSTALL_REG} "UninstallString" '"$INSTDIR\Uninstall.exe"' | ||
WriteRegDWORD ${UNINSTALL_REG} "NoModify" 1 | ||
WriteRegDWORD ${UNINSTALL_REG} "NoRepair" 1 | ||
|
||
WriteUninstaller "$INSTDIR\Uninstall.exe" | ||
DetailPrint "" | ||
SectionEnd | ||
|
||
|
||
LangString DESC_CLI ${LANG_ENGLISH} "Particle command-line interface. Add to PATH. Run as particle in the command line" | ||
LangString DESC_OPENSSL ${LANG_ENGLISH} "Tools for generating new keys for devices. Needs admin priviledges." | ||
|
||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN | ||
!insertmacro MUI_DESCRIPTION_TEXT ${CLI_SECTION} $(DESC_CLI) | ||
!insertmacro MUI_DESCRIPTION_TEXT ${OPENSSL_SECTION} $(DESC_OPENSSL) | ||
!insertmacro MUI_FUNCTION_DESCRIPTION_END | ||
|
||
;-------------------------------- | ||
; Uninstaller Sections | ||
|
||
Section "Uninstall" | ||
RMDir /r /REBOOTOK "$INSTDIR" | ||
|
||
DeleteRegKey ${UNINSTALL_REG} | ||
|
||
Push "${BINDIR}" | ||
Call un.RemoveFromPath | ||
SectionEnd | ||
|
||
|
||
Function CopyExecutables | ||
CreateDirectory "${BINDIR}" | ||
File "/oname=${BINDIR}\${EXE}" "..\..\build\particle-cli-win-x64.exe" | ||
FunctionEnd | ||
|
||
|
||
Function EnableAutoUpdates | ||
; CLI will install Node and all modules needed | ||
nsExec::ExecToLog "${BINDIR}\${EXE} autoupdate --enable" | ||
FunctionEnd | ||
|
||
Function DisableAutoUpdates | ||
; CLI will install Node and all modules needed | ||
nsExec::ExecToLog "${BINDIR}\${EXE} autoupdate --disable" | ||
FunctionEnd | ||
|
||
|
||
Function InstallOpenSSL | ||
DetailPrint "Downloading OpenSSL" | ||
File "/oname=$TEMP/${OpenSSLFile}" ".\bin\${OpenSSLFile}" | ||
DetailPrint "Installing OpenSSL" | ||
nsExec::ExecToLog "$TEMP/${OpenSSLFile} /verysilent" | ||
DetailPrint "Adding OpenSSL to path" | ||
Push "C:\OpenSSL-Win32\bin" | ||
Call AddToPath | ||
FunctionEnd | ||
|
||
Function AddCLIToPath | ||
DetailPrint "Adding CLI to path" | ||
Push "${BINDIR}" | ||
Call AddToPath | ||
FunctionEnd | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Particle CLI Installer | ||
|
||
Downloads and installs the latest CLI wrapper from binaries.particle.io, | ||
executes it a first time to install Node.js and the particle-cli module. | ||
|
||
*This installer is based on the CLI installer by Daniel Sullivan. Thanks!* | ||
|
||
## Releasing the installer | ||
|
||
- Concourse builds and signs the executable on each git push | ||
- Download the dev version of the installer from <https://binaries.particle.io/cli/installer/windows/ParticleCLISetup-dev.exe> and <https://binaries.particle.io/cli/installer/windows/ParticleDriversSetup-dev.exe> | ||
- After testing those installers, open the Concourse `release-installer` job and click the + to trigger it. It will copy the files to <https://binaries.particle.io/cli/installer/windows/ParticleCLISetup.exe> and <https://binaries.particle.io/cli/installer/windows/ParticleDriversSetup.exe> | ||
|
||
## Compile installer | ||
|
||
- Download and install Nullsoft Installer System (NSIS) version 3 | ||
- Run `MakeNSISW ParticleCLISetup.nsi` to get `ParticleCLISetup.exe` | ||
|
||
## Included components | ||
|
||
The latest [windows-device-drivers](https://github.com/particle-iot/windows-device-drivers) are downloaded when building the CLI installer. | ||
|
||
The Device Firmware Update (DFU) tools are from <http://dfu-util.sourceforge.net/> | ||
|
||
See [licences.txt](/installer/windows/licenses.txt) for more info on the open source licenses. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
:: Builds the Particle CLI installer | ||
:: | ||
:: Requirements: | ||
:: - NuGet must be installed since it is used to install NSIS | ||
:: - WINDOWS_CODE_SIGNING_CERT_ENCRYPTION_KEY environment variable must be set to decrypt the p12.enc code signing certificate | ||
:: - WINDOWS_CODE_SIGNING_CERT_PASSWORD environment variable must be set to use the p12 code signing certificate to sign the final executable | ||
:: | ||
:: Outputs: | ||
:: - ParticleCLISetup.exe | ||
pushd "%~dp0" | ||
|
||
call decrypt_code_signing_cert.cmd || goto :error | ||
|
||
nuget install NSIS-Tool -Version 3.0.8 || goto :error | ||
|
||
"NSIS-Tool.3.0.8\tools\makensis.exe" ParticleCLISetup.nsi || goto :error | ||
PowerShell "Get-FileHash ParticleCLISetup.exe -Algorithm MD5" | ||
|
||
popd | ||
|
||
goto :EOF | ||
|
||
:error | ||
exit /b %errorlevel% |
Oops, something went wrong.