Skip to content

Commit

Permalink
fix(nsis): Add allowServiceToInstall nsis option for update by window…
Browse files Browse the repository at this point in the history
… service

If window service needs to run installer for update, the installer must have admin previlege.
  • Loading branch information
HwangTaehyun committed Apr 15, 2022
1 parent 85a3e55 commit c89caf9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/poor-windows-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

Set isAdminRightsRequired option true regardless of oneClick option
5 changes: 4 additions & 1 deletion packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,12 @@ export class NsisTarget extends Target {
.join(", "),
}
const isPerMachine = options.perMachine === true
const allowServiceToInstall = options.allowServiceToInstall !== false

if (!this.isPortable) {
logFields.oneClick = oneClick
logFields.perMachine = isPerMachine
logFields.allowServiceToInstall = allowServiceToInstall
}

await packager.info.callArtifactBuildStarted(
Expand Down Expand Up @@ -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) {
updateInfo.isAdminRightsRequired = true
}

Expand Down
6 changes: 6 additions & 0 deletions packages/app-builder-lib/src/targets/nsis/nsisOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
*/
readonly allowToChangeInstallationDirectory?: boolean

/**
* *Whether to allow window servie to install for update.
* @default false
*/
readonly allowServiceToInstall?: boolean

/**
* The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
* Defaults to `build/installerIcon.ico` or application icon.
Expand Down

0 comments on commit c89caf9

Please sign in to comment.