From 25236099965f40588a8d96839a662bf8fd2b1eba Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 9 Feb 2026 14:49:07 +0100 Subject: [PATCH] disable loading of user defined config for windows msi (#4132) --- dist/win/contrib/disableUserConfig.bat | 12 ++++++++++++ dist/win/contrib/disableUserConfig.ps1 | 24 ++++++++++++++++++++++++ dist/win/resources/main.wxs | 7 ++++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 dist/win/contrib/disableUserConfig.bat create mode 100644 dist/win/contrib/disableUserConfig.ps1 diff --git a/dist/win/contrib/disableUserConfig.bat b/dist/win/contrib/disableUserConfig.bat new file mode 100644 index 000000000..dd26ca402 --- /dev/null +++ b/dist/win/contrib/disableUserConfig.bat @@ -0,0 +1,12 @@ +@echo off +:: Batch wrapper for PowerShell script to disable user configuration in Cryptomator +:: This is executed as a Custom Action during MSI installation +:: This file must be located in the INSTALLDIR + +:: Change to INSTALLDIR +cd %~dp0 +:: Execute the PowerShell script +powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -File ".\disableUserConfig.ps1" + +:: Return the exit code from PowerShell +exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/dist/win/contrib/disableUserConfig.ps1 b/dist/win/contrib/disableUserConfig.ps1 new file mode 100644 index 000000000..4ed9a5c51 --- /dev/null +++ b/dist/win/contrib/disableUserConfig.ps1 @@ -0,0 +1,24 @@ +# PowerShell script to disable user configuration +# This script is executed as a Custom Action during MSI installation +# It deletes the file .package, effectively disabling user specific jpackage configuration. +# NOTE: This file must be located in the same directory as set in the MSI property INSTALLDIR + +try { + + # Determine file path + $packageFile = Join-Path $PSScriptRoot 'app\.package' + + #check if file exists + if (Test-Path -Path $packageFile) { + Write-Host "Deleting file: $packageFile" + Remove-Item -Path $packageFile -Force -ErrorAction Stop + } else { + Write-Host "File not found: $packageFile. Skipping deletion." + } + + exit 0 +} +catch { + Write-Error "Error deleting package file: $_" + exit 1 +} \ No newline at end of file diff --git a/dist/win/resources/main.wxs b/dist/win/resources/main.wxs index 6310c6985..7269c29f5 100644 --- a/dist/win/resources/main.wxs +++ b/dist/win/resources/main.wxs @@ -132,6 +132,10 @@ + + + + @@ -188,9 +192,10 @@ + - +