diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index 2045fc6da..62d72215d 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -165,7 +165,7 @@ jobs: --java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=\"Cryptomator\"" --java-options "-Dcryptomator.integrationsWin.keychainPaths=\"@{appdata}/Cryptomator/keychain.json;@{userhome}/AppData/Roaming/Cryptomator/keychain.json\"" --java-options "-Dcryptomator.integrationsWin.windowsHelloKeychainPaths=\"@{appdata}/Cryptomator/windowsHelloKeychain.json\"" - --java-options "-Djavafx.verbose=${{ inputs.isDebug }}" + --java-options "-Dcryptomator.disableUpdateCheck=false" --resource-dir dist/win/resources --icon dist/win/resources/Cryptomator.ico --add-launcher "Cryptomator (Debug)=dist/win/debug-launcher.properties" diff --git a/dist/win/build.ps1 b/dist/win/build.ps1 index b1706a28e..272b6e50b 100644 --- a/dist/win/build.ps1 +++ b/dist/win/build.ps1 @@ -165,6 +165,7 @@ $javaOptions = @( "--java-options", "-Dcryptomator.integrationsWin.windowsHelloKeychainPaths=`"@{appdata}/$AppName/windowsHelloKeychain.json`"" "--java-options", "-Dcryptomator.showTrayIcon=true" "--java-options", "-Dcryptomator.buildNumber=`"msi-$revisionNo`"" +"--java-options", "-Dcryptomator.disableUpdateCheck=false" ) diff --git a/dist/win/bundle/bundleWithWinfsp.wxs b/dist/win/bundle/bundleWithWinfsp.wxs index 1c9e7da20..c3bec0ee8 100644 --- a/dist/win/bundle/bundleWithWinfsp.wxs +++ b/dist/win/bundle/bundleWithWinfsp.wxs @@ -27,6 +27,8 @@ + + @@ -41,7 +43,9 @@ Do you want to continue?"" RepairArgument="-q" UninstallArgument="-s" /> - + + + diff --git a/dist/win/contrib/patchUpdateCheck.bat b/dist/win/contrib/patchUpdateCheck.bat new file mode 100644 index 000000000..f93a7ff0a --- /dev/null +++ b/dist/win/contrib/patchUpdateCheck.bat @@ -0,0 +1,18 @@ +@echo off +:: Batch wrapper for PowerShell script to modify Cryptomator update check settings +:: This is executed as a Custom Action during MSI installation +:: This file must be located in the INSTALLDIR + +set "DISABLEUPDATECHECK=%~1" + +:: Log for debugging +echo DISABLEUPDATECHECK=%DISABLEUPDATECHECK% + +:: Change to INSTALLDIR +cd %~dp0 +:: Execute the PowerShell script +powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -File ".\patchUpdateCheck.ps1"^ + -DisableUpdateCheck "%DISABLEUPDATECHECK%" + +:: Return the exit code from PowerShell +exit /b %ERRORLEVEL% \ No newline at end of file diff --git a/dist/win/contrib/patchUpdateCheck.ps1 b/dist/win/contrib/patchUpdateCheck.ps1 new file mode 100644 index 000000000..3bb3cac15 --- /dev/null +++ b/dist/win/contrib/patchUpdateCheck.ps1 @@ -0,0 +1,52 @@ +# PowerShell script to modify Cryptomator.cfg to set disableUpdateCheck property +# This script is executed as a Custom Action during MSI installation +# If the DisableUpdateCheck parameter is set to true, it disables the update check in Cryptomator by modifying the Cryptomator.cfg file. +# NOTE: This file must be located in the same directory as set in the MSI property INSTALLDIR + +param( + [Parameter(Mandatory)][string]$DisableUpdateCheck +) + +try { + # Log parameters for debugging (visible in MSI verbose logs) + Write-Host "DisableUpdateCheck: $DisableUpdateCheck" + + # Parse DisableUpdateCheck value (handle various input formats) + $shouldDisable = $false + if ($DisableUpdateCheck) { + $DisableUpdateCheck = $DisableUpdateCheck.Trim().ToLower() + $shouldDisable = ($DisableUpdateCheck -eq 'true') -or ($DisableUpdateCheck -eq '1') -or ($DisableUpdateCheck -eq 'yes') + } + + Write-Host "Setting cryptomator.disableUpdateCheck to: $shouldDisable" + if (-not $shouldDisable) { + Write-Host "Disable-Update-Check property is by default 'false'. Skipping config modification." + exit 0 + } + + # Determine the .cfg file path + $cfgFile = Join-Path $($PSScriptRoot) "app\Cryptomator.cfg" + + if (-not (Test-Path $cfgFile)) { + Write-Error "Configuration file not found at: $cfgFile" + exit 1 + } + + # Read the current configuration + $content = Get-Content $cfgFile -Raw + + # Add the new option based on the property value + # Use regular expressions substitutions to replace the property + $searchExpression = '(?java-options=-Dcryptomator\.disableUpdateCheck)=false' + $replacementExpression = '${Prefix}=true' + $content = $content -replace $searchExpression,$replacementExpression + + # Write the modified content back + Set-Content -Path $cfgFile -Value $content -NoNewline + Write-Host "Successfully updated $cfgFile" + exit 0 +} +catch { + Write-Error "Error modifying configuration file: $_" + exit 1 +} \ No newline at end of file diff --git a/dist/win/resources/main.wxs b/dist/win/resources/main.wxs index 5616193a7..f63f7514d 100644 --- a/dist/win/resources/main.wxs +++ b/dist/win/resources/main.wxs @@ -126,10 +126,18 @@ + + + + + + + + + +