Skip to content

Commit df89ccc

Browse files
feat(nsis): implement passive mode, closes #6955 (#6998)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 60334f9 commit df89ccc

File tree

11 files changed

+147
-81
lines changed

11 files changed

+147
-81
lines changed

.changes/nsis-downgrades.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri-bundler': 'patch'
3+
---
4+
5+
Fix NSIS installer disabling `do not uninstall` button and silent installer aborting, if `allowDowngrades` was disabled even when we are not downgrading.

.changes/nsis-passive-mode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri': 'minor'
3+
---
4+
5+
Support `passive` mode for NSIS updater.

.changes/nsis-restart-flag.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri-bundler': 'minor'
3+
---
4+
5+
For NSIS, Add support for `/P` to install or uninstall in passive mode, `/R` to (re)start the app and `/NS` to disable creating shortcuts in `silent` and `passive` modes.

.changes/nsis-silent-kill.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri-bundler': 'minor'
3+
---
4+
5+
NSIS `silent` and `passive` installer/updater will auto-kill the app if its running.

.changes/nsis-silent-shortcuts.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri-bundler': 'patch'
3+
---
4+
5+
Fix NSIS silent installer not creating Desktop and StartMenu shortcuts. Pass `/NS` to disable creating them.

core/tauri-config-schema/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2822,7 +2822,7 @@
28222822
]
28232823
},
28242824
{
2825-
"description": "Specifies unattended mode, which means the installation only shows a progress bar. **msi (Wix) Only**",
2825+
"description": "Specifies unattended mode, which means the installation only shows a progress bar.",
28262826
"type": "string",
28272827
"enum": [
28282828
"passive"

core/tauri-utils/src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,7 @@ pub enum WindowsUpdateInstallMode {
24662466
/// The quiet mode means there's no user interaction required.
24672467
/// Requires admin privileges if the installer does.
24682468
Quiet,
2469-
/// Specifies unattended mode, which means the installation only shows a progress bar. **msi (Wix) Only**
2469+
/// Specifies unattended mode, which means the installation only shows a progress bar.
24702470
Passive,
24712471
// to add more modes, we need to check if the updater relaunch makes sense
24722472
// i.e. for a full UI mode, the user can also mark the installer to start the app
@@ -2485,6 +2485,7 @@ impl WindowsUpdateInstallMode {
24852485
/// Returns the associated nsis arguments.
24862486
pub fn nsis_args(&self) -> &'static [&'static str] {
24872487
match self {
2488+
Self::Passive => &["/P", "/R"],
24882489
Self::Quiet => &["/S", "/R"],
24892490
_ => &[],
24902491
}

core/tauri/src/updater/core.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -735,15 +735,11 @@ fn copy_files_and_run<R: Read + Seek>(
735735
// If it's an `exe` we expect an installer not a runtime.
736736
if found_path.extension() == Some(OsStr::new("exe")) {
737737
// Run the EXE
738-
let mut installer = Command::new(found_path);
739-
if crate::utils::config::WindowsUpdateInstallMode::Quiet
740-
== config.tauri.updater.windows.install_mode
741-
{
742-
installer.args(config.tauri.updater.windows.install_mode.nsis_args());
743-
}
744-
installer.args(&config.tauri.updater.windows.installer_args);
745-
746-
installer.spawn().expect("installer failed to start");
738+
Command::new(found_path)
739+
.args(config.tauri.updater.windows.install_mode.nsis_args())
740+
.args(&config.tauri.updater.windows.installer_args)
741+
.spawn()
742+
.expect("installer failed to start");
747743

748744
exit(0);
749745
} else if found_path.extension() == Some(OsStr::new("msi")) {

0 commit comments

Comments
 (0)