nsiselectron-builderdpinst

Add NSIS script with electron builder to run DPInst.exe during install


I'm using electron-builder to create NSIS Windows installers for my electron app. During install I need to run the included DPInst.exe to make sure drivers get installed.

I can tell electron-builder than I'm including a custom script:

"nsis": {
  "include": "build/installer.nsh"
}

But I can't work out what should be in the installer.nsh

The docs say that I need something like:

!macro customInstall
  !system "echo '' > ${BUILD_RESOURCES_DIR}/customInstall"
!macroend

And I've seen some NSIS commands to run DPInst.exe

ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'

But I'm unsure how to combine them as I can't work out the syntax!


Solution

  • Well, it was pretty obvious 🤦‍♂️. I just had to combine the two:

    !macro customInstall
      ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
    !macroend