π§β¨ Beautiful email. For everyone.
fix: install the current SimplySign release on Windows (#43)
Paul Koeckc5cff08482c1
diff --git a/.github/scripts/install-simplysign.ps1 b/.github/scripts/install-simplysign.ps1new file mode 100644index 0000000..d4218f9--- /dev/null+++ b/.github/scripts/install-simplysign.ps1@@ -0,0 +1,56 @@+# Install the current Windows 64-bit English release published by Certum.+# Using the supported download page avoids installing an old version whose+# update dialog can intercept the automated login's keystrokes.+$ErrorActionPreference = 'Stop'++$downloadPage = 'https://support.certum.eu/en/software/procertum-smartsign/'+$tempDirectory = if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { [System.IO.Path]::GetTempPath() }+$installerPath = Join-Path $tempDirectory 'SimplySignDesktop.msi'+$logPath = Join-Path $tempDirectory 'simplysign-install.log'+$exePath = 'C:\Program Files\Certum\SimplySign Desktop\SimplySignDesktop.exe'++Write-Host "Finding the latest SimplySign Desktop installer on $downloadPage"+$page = Invoke-WebRequest -Uri $downloadPage -UseBasicParsing -TimeoutSec 60++# Only accept the English x64 MSI on Certum's own HTTPS download host, with+# matching versions in the directory and filename. Ignore EXEs and 32-bit MSIs.+$installerPattern = 'https://files\.certum\.eu/software/SimplySignDesktop/Windows/(?<version>\d+\.\d+\.\d+\.\d+)/SimplySignDesktop-\k<version>-64-bit-en\.msi'+$installers = @([regex]::Matches($page.Content, $installerPattern) |+ Sort-Object { [version]$_.Groups['version'].Value } -Descending)+if ($installers.Count -eq 0) {+ throw "Certum's download page did not contain a Windows 64-bit English SimplySign MSI: $downloadPage"+}+$installerUrl = $installers[0].Value+$installerVersion = $installers[0].Groups['version'].Value+Write-Host "Downloading SimplySign Desktop $installerVersion from $installerUrl"+Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -UseBasicParsing -TimeoutSec 600++# A pinned SHA-256 would prevent automatic updates. Instead require Windows+# to validate the Authenticode signature and check Certum's software publisher.+$signature = Get-AuthenticodeSignature -LiteralPath $installerPath+if ($signature.Status -ne 'Valid') {+ throw "SimplySign installer signature is not valid: $($signature.Status) ($($signature.StatusMessage))"+}+$publisher = $signature.SignerCertificate.GetNameInfo([System.Security.Cryptography.X509Certificates.X509NameType]::SimpleName, $false)+if ($publisher -ne 'Asseco Data Systems S.A.') {+ throw "Unexpected SimplySign installer publisher: $publisher"+}+Write-Host "Verified installer signature from $publisher"+Write-Host "Installer SHA-256: $((Get-FileHash -LiteralPath $installerPath -Algorithm SHA256).Hash)"++# Use the same silent installation options as the original BlinkDisk setup,+# but check the actual installer exit code rather than log text or directory existence.+Remove-Item -LiteralPath $logPath -Force -ErrorAction SilentlyContinue+Write-Host "Installing SimplySign Desktop $installerVersion"+$arguments = "/i `"$installerPath`" /quiet /norestart /l*v `"$logPath`" ALLUSERS=1 REBOOT=ReallySuppress"+$installer = Start-Process -FilePath 'msiexec.exe' -ArgumentList $arguments -Wait -PassThru+if ($installer.ExitCode -notin @(0, 3010)) {+ if (Test-Path -LiteralPath $logPath) {+ Get-Content -LiteralPath $logPath -Tail 20 | Write-Host+ }+ throw "SimplySign installation failed with exit code $($installer.ExitCode). Installer log: $logPath"+}+if (-not (Test-Path -LiteralPath $exePath)) {+ throw "SimplySign installation completed but the executable was not found: $exePath"+}+Write-Host "SimplySign Desktop installed: $((Get-Item -LiteralPath $exePath).VersionInfo.FileVersion)"diff --git a/.github/scripts/install-simplysign.sh b/.github/scripts/install-simplysign.shdeleted file mode 100755index 71ee674..0000000--- a/.github/scripts/install-simplysign.sh+++ /dev/null@@ -1,123 +0,0 @@-#!/bin/bash-# Ported from blinkdisk/blinkdisk .github/scripts/install-simplysign.sh.-# Keep the pinned installer and installation sequence used by BlinkDisk.--set -euo pipefail--echo "=== INSTALLING SIMPLYSIGN DESKTOP ==="-echo "Using proven installation method from successful testing..."--# Download SimplySign Desktop MSI-CERTUM_INSTALLER="SimplySignDesktop.msi"-echo "Downloading SimplySign Desktop MSI..."--if curl -L "https://files.certum.eu/software/SimplySignDesktop/Windows/9.4.3.90/SimplySignDesktop-9.4.3.90-64-bit-en.msi" -o "$CERTUM_INSTALLER" --fail --max-time 600; then- echo "β Downloaded SimplySign Desktop MSI ($(ls -lh "$CERTUM_INSTALLER" | awk '{print $5}'))"-else- echo "β Failed to download SimplySign Desktop"- exit 1-fi--EXPECTED_CHECKSUM="ce2b38ef0124a574bc08e5558726099caac79a7c58b8d3d712f629371fe1bcb7"-ACTUAL_CHECKSUM=$(sha256sum "$CERTUM_INSTALLER" | awk '{print $1}')--if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then- echo "β Checksum verification failed"- echo "Expected: $EXPECTED_CHECKSUM"- echo "Actual: $ACTUAL_CHECKSUM"- exit 1-fi-echo "β Checksum verified"--# Install with proven method (matching successful test)-echo "Installing SimplySign Desktop..."-echo "Full command: msiexec /i \"$CERTUM_INSTALLER\" /quiet /norestart /l*v install.log ALLUSERS=1 REBOOT=ReallySuppress"--# Check for administrative privileges (like the successful test)-ADMIN_RIGHTS=false-if powershell -Command "([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)" 2>/dev/null; then- echo "β Running with administrative privileges"- ADMIN_RIGHTS=true-else- echo "β οΈ No explicit administrative privileges detected"-fi--# Use the exact method that worked: PowerShell with admin privileges-if [ "$ADMIN_RIGHTS" = true ]; then- echo "Running MSI installation with administrator privileges..."- powershell -Command "Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i', '\"$CERTUM_INSTALLER\"', '/quiet', '/norestart', '/l*v', 'install.log', 'ALLUSERS=1', 'REBOOT=ReallySuppress' -Wait -NoNewWindow -PassThru" &- INSTALL_PID=$!-else- echo "Running MSI installation without explicit admin elevation..."- timeout 300 msiexec /i "$CERTUM_INSTALLER" /quiet /norestart /l*v install.log ALLUSERS=1 REBOOT=ReallySuppress &- INSTALL_PID=$!-fi--# Monitor with the same logic as successful test-echo "Monitoring installation progress..."-INSTALL_START_TIME=$(date +%s)-sleep 10--# Check if msiexec process is actually running (like successful test)-if kill -0 $INSTALL_PID 2>/dev/null; then- echo "MSI installation process is running (PID: $INSTALL_PID)"-- # Monitor for up to 3 minutes with status updates- for i in {1..18}; do- sleep 10- CURRENT_TIME=$(date +%s)- ELAPSED=$((CURRENT_TIME - INSTALL_START_TIME))-- if kill -0 $INSTALL_PID 2>/dev/null; then- echo "Installation still running after ${ELAPSED} seconds..."-- # Check log file growth- if [ -f "install.log" ]; then- LOG_SIZE=$(stat -c%s "install.log" 2>/dev/null || stat -f%z "install.log" 2>/dev/null || echo 0)- echo " Log file size: $LOG_SIZE bytes"- fi- else- echo "MSI installation completed after ${ELAPSED} seconds"- break- fi- done-- # Final wait if still running- if kill -0 $INSTALL_PID 2>/dev/null; then- echo "Installation taking longer, waiting for completion..."- wait $INSTALL_PID 2>/dev/null || echo "Installation process ended"- fi-else- echo "MSI installation process ended quickly"-fi--# Quick success check using proven patterns-INSTALLATION_SUCCESSFUL=false-if [ -f "install.log" ]; then- if grep -qi "Installation.*operation.*completed.*successfully\|Installation.*success.*or.*error.*status.*0\|MainEngineThread.*is.*returning.*0\|Windows.*Installer.*installed.*the.*product" install.log 2>/dev/null; then- echo "β Installation successful (confirmed by log patterns)"- INSTALLATION_SUCCESSFUL=true- fi-fi--# Verify installation directory-INSTALL_PATH="/c/Program Files/Certum/SimplySign Desktop"-if [ -d "$INSTALL_PATH" ]; then- echo "β SimplySign Desktop installed successfully"- echo "β Virtual card emulation now active for code signing"- INSTALLATION_SUCCESSFUL=true-- # Set output for GitHub Actions- if [ -n "${GITHUB_OUTPUT:-}" ]; then- echo "SIMPLYSIGN_PATH=$INSTALL_PATH" >> "$GITHUB_OUTPUT"- fi-fi--if [ "$INSTALLATION_SUCCESSFUL" = false ]; then- echo "β Installation verification failed"- echo "Last 10 lines of install log:"- tail -10 install.log 2>/dev/null || echo "No install log available"- exit 1-fi--echo "π SimplySign Desktop installation completed successfully!"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex e6b02d7..04a5f55 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -99,7 +99,7 @@ jobs:exit 1fidone- bash .github/scripts/install-simplysign.sh+ powershell -NoProfile -ExecutionPolicy Bypass -File .github/scripts/install-simplysign.ps1powershell -NoProfile -ExecutionPolicy Bypass -File .github/scripts/configure-simplysign.ps1powershell -NoProfile -ExecutionPolicy Bypass -File .github/scripts/connect-simplysign.ps1- name: Package desktop app