Go Down

Topic: I wrote a Windows installer for Arduino (Read 2164 times) previous topic - next topic


Oct 20, 2009, 04:12 pm Last Edit: Oct 20, 2009, 06:55 pm by frank26080115 Reason: 1
This is a NSIS script, really quick and simple once you figure out how to use them. The Arduino team can compile this script to generate a single installer. I'm hoping the team will try this out.

Code: [Select]

!include "MUI2.nsh"


;SetCompressor /SOLID /FINAL lzma

Name "Arduino 0017" ; Installer Name

RequestExecutionLevel highest ; Hope that the user is an admin and can install stuff

OutFile "arduino_0017_installer.exe" ; Installer file name

; Set default installation directory, or look for a previous installation
InstallDir $PROGRAMFILES\arduino
InstallDirRegKey HKCU "Software\arduino" ""

; Order the installation wizard pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_FINISH

; Order the uninstallation wizard pages
!insertmacro MUI_UNPAGE_FINISH

; Installer language
!insertmacro MUI_LANGUAGE "English"

Section ;"Required"

     ; Backup the hardware folder since people may have custom files in there (this is for upgrading)
     CreateDirectory $INSTDIR\0017_backup_hardware
     CopyFiles /SILENT $INSTDIR\hardware\*.*  $INSTDIR\0017_backup_hardware

     ; Copy all files
     SetOutPath $INSTDIR      
     File /r arduino-0017\*.*
     ; Generate uninstaller, see Uninstall section
     WriteUninstaller $INSTDIR\uninstaller.exe
     ; Write information for Windows Add/Remove Software
     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\arduino" "DisplayName" "Arduino"      
     WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\arduino" "UninstallString" "$\"$INSTDIR\uninstaller.exe$\""      
     WriteRegStr HKCU "Software\arduino" "" $INSTDIR

Section "Desktop Shortcut" SecDesktopShortcut

     SetOutPath $DESKTOP
     CreateShortCut $DESKTOP\Arduino.lnk $INSTDIR\arduino.exe

Section "Start Menu Entry" SecStartMenu

     SetOutPath $STARTMENU\Arduino
     CreateShortCut $STARTMENU\Arduino\Arduino.lnk $INSTDIR\arduino.exe
     CreateShortCut $STARTMENU\Arduino\Uninstall.lnk $INSTDIR\uninstaller.exe

; Describe the sections here
LangString DESC_DesktopShortcut ${LANG_ENGLISH} "A shortcut to Arduino on your desktop"
LangString DESC_StartMenu ${LANG_ENGLISH} "A shortcut to Arduino on in your start menu"

!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(DESC_DesktopShortcut)
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_StartMenu)

Section "Uninstall" ; Uninstaller actions
     ; Remove installation completely
     Delete $INSTDIR\*.*
     RMDir /r $INSTDIR

     ; Remove created shortcuts
     Delete $STARTMENU\Arduino\Arduino.lnk
     RMDir /r $STARTMENU\Arduino
     Delete $DESKTOP\Arduino.lnk
     ; Remove from Windows's Add/Remove Programs
     DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\arduino"

To compile the installation script, go get http://nsis.sourceforge.net/

By using the LZMA Solid Final compression method, the final installer size was about 47 mb, but I commented that line out just in case you guys don't like LZMA for whatever reason (it's slow during compression so it may not be good during testing, but good for release builds)

The installer will make a back-up of the user's hardware folder during upgrades. There is an uninstaller included and adds an entry to the Add/Remove Programs control panel. Desktop and start menu shortcuts are optional.


Sounds ok, maybe I will use it if you make one for the new IDE when it comes out...

Does it currently keep libraries from the previous install and integrate them into the new one? If not then that would be a good next step...



the arduino team would have to release this
the script does do a backup of the hardware folder, but only a backup, so that updated libraries are applied, any additional libraries that are not a part of the standard package would not be affected i think


As it happens, I need an Arduino Windows Installer for a CD I'm producing as part of an educational kit.  Mind if I use a slightly modified version of this script to produce said installer?  It would save me a few hours of writing essentially the same script :-)

Go Up