-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix(nsis): If window service needs to run installer for update, the installer must have admin previlege. #6786 #6787
Conversation
🦋 Changeset detectedLatest commit: bb2aef5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for car-park-attendant-cleat-11576 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Instead of removing
This change breaks a snapshot test and I'm unsure if all assisted installers should have
|
@mmaietta Thank you for review. I'll try to detect for this edge case and change my code! |
I detected an edge case for using the allowServiceToInstall boolean option of nsis in the electron builder config |
@@ -319,7 +322,7 @@ export class NsisTarget extends Target { | |||
updateInfo = await createBlockmap(installerPath, this, packager, safeArtifactName) | |||
} | |||
|
|||
if (updateInfo != null && isPerMachine && oneClick) { | |||
if ((updateInfo != null && isPerMachine && oneClick) || allowServiceToInstall) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you already using packElevateHelper = true
by chance? Would this work instead?
(updateInfo != null && isPerMachine && (oneClick || options.packElevateHelper))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the elevate.exe file is already included in my electron app because of perMachine true option.
Electron updater decides to elevate or not using isAdminRightsRequired in the update-info.json file.
(https://github.com/electron-userland/electron-builder/blob/5e381c556d12ce185bb7ea720380509c1ddc5cf7/packages/electron-updater/src/NsisUpdater.ts#:~:text=if%20(options.isAdminRightsRequired,%7D)
So, it's seamless using packElevateHelper option beacuse if elevate.exe packed, then electron updater must using this to elevate when update.
I'll edit this based on your feedback!
Just to play it safe, can you please also add this test to the
You can update the snapshot via:
After that, I think we're good to merge! |
…nsis packElevateHelper option in electron-builder config If window service needs to run installer for update, the installer must have admin previlege. Electron-updater detects whether elevating or not using isAdminRightsRequired in update-info.json. And this isAdminRightsRequired true option should be added to latest.yml using nsis's packElevateHelper option
I added the test code to this commit! |
I checked it. below nsis option's generate the following latest.yml.
|
If the electron app needs a custom NSIS installer script (aka. oneClick option is false), the electron installer cannot get isAdminRightsRequired and failed to update when the electron app is running on window service because it requires installer that being admin rights.
It seems that any other reason does not exist when the electron builder NSIS oneClick option is false, update-info's isAdminRightsRequired is false.
Thank you!