NSIS installer for Windows
I've been wanting to create a custom windows installer for a while, I have known about NSIS for sometime, but was using the 7zip SFX installer.
I wanted a very basic installer, bundle up some files into an exe, set the default path, add a little eye candy in the way of graphics. NSIS can access the registry reading and adding entries, but I'm just installing a plugin, and it seems a little overkill for what I wanted.
NSIS is actually great, the forums at winamp, not so much. It might be just that I have got used to stackoverflow's very helpful userbase, but I found the answers at winamp, less than helpful, "just read the documentation" one said, that's not what you need when you're just starting out, you want to get something working asap!
The method I was trying was to the zip2exe NSIS installer builders, then hack the .log file, but the it was producing a large list of files to add to the installer at compile time, I didn't fancy try to write a .bat file to list all the files.
So eventually I found the magic command was:
File /r recurses the given directory (bit like "dir /s")
File /r "..\..\..\..\*.*"
If you're installing to program files, you will need (esp on windows 7!)
RequestExecutionLevel admin
MUI_ICON .ico files need to be proper icon files (you can save these in Gimp) 48x48 pixels
MUI_WELCOMEFINISHPAGE_BITMAP needs to be 164x314 8 bit depth (255 colours)
http://ctlabs.blogspot.co.uk/2009/02/nullsoft-scriptable-install-system-nsis.html
So my code ended up looking something like this:
; Define your application name
!define APPNAME "Images2SU"
!define APPNAMEANDVERSION "Images2SU"
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Google\Google SketchUp 7\Plugins"
RequestExecutionLevel admin
; Modern interface settings
;--------------------------------
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
!define MUI_ICON "icon.ico"
;--------------------------------
; !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
Section "Images2SU" Section1
; Set Section Files and Shortcuts
File /r "..\..\..\..\*.*"
; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END
BrandingText "Acoustic Dimensions"