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!
Well, it was pretty obvious 🤦♂️. I just had to combine the two:
!macro customInstall
ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
!macroend
For me, ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
alone wasn't working because of permission issues.
I had to add RequestExecutionLevel admin
installer.nsh looks like -
!macro customHeader
RequestExecutionLevel admin
!macroend
!macro customInstall
ExecWait '"$INSTDIR\ABC_Setup.exe" /sw'
!macroend
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With