Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSIS script #583

Closed
giacgbj opened this issue Jul 13, 2016 · 12 comments · May be fixed by qcif/data-curator#563
Closed

NSIS script #583

giacgbj opened this issue Jul 13, 2016 · 12 comments · May be fixed by qcif/data-curator#563

Comments

@giacgbj
Copy link

giacgbj commented Jul 13, 2016

Would it be possible to use a NSIS script instead of waiting for a mapping of the (many) options NSIS has?

For example, I'd need a way to register a custom scheme during the installation phase on Windows.

@develar
Copy link
Member

develar commented Jul 14, 2016

Ability to pass own nsis script? Will be implemented.

@giacgbj
Copy link
Author

giacgbj commented Jul 14, 2016

Exactly. It would be very useful.
Can you predict approximately when this feature will be added?

@develar
Copy link
Member

develar commented Jul 14, 2016

Can you predict approximately when this feature will be added?

1-4 days.

@atypicalprogrammer
Copy link

how do you register a custom scheme with nsis btw, @giacgbj? (sorry, offtopic!)

@giacgbj
Copy link
Author

giacgbj commented Jul 16, 2016

@black-snow
Copy link
Contributor

Upvoting this to the max. I have to ship a 3rd party installer along with my app. With electron-boilerplate I was able to use a custom NSIS script to run the 3rd party installer from within the NSIS installer.

@develar
Copy link
Member

develar commented Jul 27, 2016

We don't yet support specifying custom script, but allows you to customise without a headache.

As I don't have time to finish docs yet, draft here:

  1. Add file build/installer.nsh.

  2. Define wanted macro to customise: customHeader, customInit, customUnInit, customInstall, customUnInstall.

    Example:

    !macro customHeader
      !system "echo '' > ${BUILD_RESOURCES_DIR}/customHeader"
    !macroend
    
    !macro customInit
      !system "echo '' > ${BUILD_RESOURCES_DIR}/customInit"
    !macroend
    
    !macro customInstall
      !system "echo '' > ${BUILD_RESOURCES_DIR}/customInstall"
    !macroend
  • BUILD_RESOURCES_DIR and PROJECT_DIR defined for you.
  • build is added as addincludedir for you (i.e. you don't need to use BUILD_RESOURCES_DIR to include subfiles).

Pre-release version will be in a hour.

develar added a commit to develar/electron-builder that referenced this issue Jul 28, 2016
@ghost
Copy link

ghost commented Aug 29, 2016

I tried following the instructions develar gave above, but it didn't work for me. See: #623 (comment)

Update: Apparently URL schemes in windows only work on perMachine: true apps.

@electronomad
Copy link

@joshua-smith : I set perMachine : true and nsh script still not writing register key after installation process !!

installer.nsh

!macro customInstall DetailPrint "Register test URI Handler" DeleteRegKey HKCR "test" WriteRegStr HKCR "test" "" "URL:test" WriteRegStr HKCR "test" "URL Protocol" "" WriteRegStr HKCR "test\shell" "" "" WriteRegStr HKCR "test\shell\Open" "" "" WriteRegStr HKCR "test\shell\Open\command" "" "$INSTDIR\${APP_EXECUTABLE_FILENAME} %1" !macroend

package.json

`{
"name": "electron app",
"productName": "electronapp",
"version": "0.1.0",
"author": "me",
"description": "electron app test",
"main": "main.js",
"devDependencies": {
"electron-builder": "^20.28.3",
"electron-packager": "^12.1.1",
"electron-winstaller": "^2.6.4",
"electron": "^1.8.8"
},
"build": {
"appId": "fr.digitalberry.berryagent",
"win": {
"target": "nsis",
"icon": "build/icon.ico"
}
},
"scripts": {
"start": "electron .",
"dist": "build",
"test": "echo "Error: no test specified" && exit 1",

},
"dependencies": {
},
"nsis": {
    "oneClick" : false , 
    "allowToChangeInstallationDirectory": true, 
    "include" : "build/script.nsh" , 
    "perMachine" : true 
    
}

}
`

@mrjoshuaesmith
Copy link

My installer.nsh is pretty much just like yours, except I have line breaks. I assume that's just a formatting glitch here. It's working for me, but I'm on a very, very old version of electron-builder because it's working just fine for me and I've had no reason to update. Try putting a syntax error into the installer.nsh file and see if it's actually reading it.

@electronomad
Copy link

@mrjoshuaesmith
Thank you for your attention , what version of electron builder do you use ?

@ghost
Copy link

ghost commented Sep 5, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants