|
1 | 1 | { |
2 | 2 | "version": "1.3.4466.51", |
3 | | - "description": "OpenVPN Client", |
| 3 | + "description": "A free and open source cross platform OpenVPN client.", |
4 | 4 | "homepage": "https://client.pritunl.com", |
5 | 5 | "license": { |
6 | 6 | "identifier": "Freeware", |
7 | | - "url": "https://github.com/pritunl/pritunl-client-electron/blob/master/LICENSE" |
| 7 | + "url": "https://github.com/pritunl/pritunl-client-electron/blob/HEAD/LICENSE" |
8 | 8 | }, |
| 9 | + "suggest": { |
| 10 | + "Microsoft Visual C++ 2015-2022 Redistributable": "extras/vcredist2022" |
| 11 | + }, |
| 12 | + "url": "https://github.com/pritunl/pritunl-client-electron/releases/download/1.3.4466.51/Pritunl.exe#/dl.exe", |
| 13 | + "hash": "sha512:704afa0da898efc80aa9897b2cd0d5df8e4732382e0ee5d31461c3d3b80abb68a05a3c6f155039af264619e8a85014c60421400cd75d3d7db512e19040b74f40", |
| 14 | + "innosetup": true, |
9 | 15 | "architecture": { |
10 | 16 | "64bit": { |
11 | | - "url": "https://github.com/pritunl/pritunl-client-electron/releases/download/1.3.4466.51/Pritunl.exe#/dl.exe", |
12 | | - "hash": "d6b43bf1832d2f2f3f44d7942bb9d6a6c32f17ec4acc711a2458daa8db7cda8b" |
| 17 | + "installer": { |
| 18 | + "script": [ |
| 19 | + "Get-ChildItem -Path $dir -Include '*,2*' -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue", |
| 20 | + "Get-ChildItem -Path $dir -Include '*,1*' -Recurse -File | Rename-Item -NewName { $_.Name -replace ',\\d', '' }" |
| 21 | + ] |
| 22 | + } |
| 23 | + }, |
| 24 | + "arm64": { |
| 25 | + "installer": { |
| 26 | + "script": [ |
| 27 | + "Get-ChildItem -Path $dir -Include '*,1*' -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue", |
| 28 | + "Get-ChildItem -Path $dir -Include '*,2*' -Recurse -File | Rename-Item -NewName { $_.Name -replace ',\\d', '' }" |
| 29 | + ] |
| 30 | + } |
13 | 31 | } |
14 | 32 | }, |
15 | | - "innosetup": true, |
16 | | - "pre_install": "if (-not (is_admin)) { error 'This package requires admin privileges to install'; break }", |
17 | | - "post_install": "Invoke-ExternalCommand \"$dir\\post_install.exe\" -RunAs | Out-Null", |
18 | | - "uninstaller": { |
19 | | - "script": [ |
20 | | - "if (-not (is_admin)) { error 'This package requires admin privileges to uninstall'; break }", |
21 | | - "Invoke-ExternalCommand \"$dir\\pre_uninstall.exe\" -RunAs | Out-Null", |
22 | | - "Remove-Item 'C:\\ProgramData\\Pritunl' -Recurse -Force" |
23 | | - ] |
24 | | - }, |
| 33 | + "pre_install": "if (-not (is_admin)) { abort \"`n[ERROR] $app requires admin rights to $cmd.\" }", |
| 34 | + "post_install": [ |
| 35 | + "$service_name = 'pritunl'", |
| 36 | + "$path_regex = [regex]::Escape((Split-Path -Path $dir -Parent))", |
| 37 | + "Start-Service -Name $service_name -ErrorAction SilentlyContinue", |
| 38 | + "if ($PSVersionTable.PSVersion -ge [version]::new(6, 0)) {", |
| 39 | + " $services = Get-Service -Name $service_name -ErrorAction SilentlyContinue", |
| 40 | + "} else {", |
| 41 | + " $name_filter = \"Name = '$service_name'\"", |
| 42 | + " $services = Get-CimInstance -ClassName Win32_Service -Filter $name_filter -ErrorAction SilentlyContinue |", |
| 43 | + " Select-Object -Property *, @{ Name = 'BinaryPathName'; Expression = { $_.PathName } }", |
| 44 | + "}", |
| 45 | + "$service = $services | Where-Object { $_.BinaryPathName -match $path_regex }", |
| 46 | + "if ($service -and @($service.Status, $service.State) -contains 'Running') { return }", |
| 47 | + "if ($service) { abort \"`n[ERROR] Service '$service_name' exists but failed to start. Installation terminated.\" }", |
| 48 | + "if ($services) {", |
| 49 | + " Write-Host \"`nINFO Identified a stale or conflicting service instance. Initiating removal...\" -ForegroundColor DarkGray", |
| 50 | + " Stop-Service -Name $service_name -Force -ErrorAction SilentlyContinue; Start-Sleep -Milliseconds 1500", |
| 51 | + " if ($PSVersionTable.PSVersion -ge [version]::new(6, 0)) {", |
| 52 | + " Remove-Service -Name $service_name -ErrorAction SilentlyContinue", |
| 53 | + " } else {", |
| 54 | + " Start-Process -FilePath 'sc.exe' -ArgumentList @('delete', $service_name) -NoNewWindow -Wait", |
| 55 | + " }", |
| 56 | + " $timer = [System.Diagnostics.Stopwatch]::StartNew()", |
| 57 | + " while ($timer.Elapsed.TotalSeconds -lt 16) {", |
| 58 | + " $current_elapsed = $timer.Elapsed.TotalSeconds", |
| 59 | + " $percent = [System.Math]::Min(($current_elapsed / 15) * 100, 100)", |
| 60 | + " $progress_params = @{", |
| 61 | + " Activity = 'Service Management'; PercentComplete = $percent", |
| 62 | + " CurrentOperation = \"Elapsed: $current_elapsed s / Timeout: 15 s\"", |
| 63 | + " Status = \"Waiting for '$service_name' to be fully de-registered...\"", |
| 64 | + " }", |
| 65 | + " $check = Get-Service -Name $service_name -ErrorAction SilentlyContinue", |
| 66 | + " if ($null -eq $check) {", |
| 67 | + " $progress_params['Status'] = 'Service successfully uninstalled.'", |
| 68 | + " $progress_params['PercentComplete'] = 100", |
| 69 | + " $progress_params['Completed'] = $true", |
| 70 | + " Write-Progress @progress_params", |
| 71 | + " break", |
| 72 | + " }", |
| 73 | + " Write-Progress @progress_params", |
| 74 | + " Start-Sleep -Milliseconds 2500", |
| 75 | + " }", |
| 76 | + " $timer.Stop()", |
| 77 | + " abort 'Please reboot your computer to complete the uninstallation, then try again.'", |
| 78 | + "}", |
| 79 | + "$service_config = @{", |
| 80 | + " Name = $service_name", |
| 81 | + " BinaryPathName = \"`\"$dir\\pritunl-service.exe`\"\"", |
| 82 | + " DisplayName = 'Pritunl Client Helper Service'", |
| 83 | + " Description = 'Provides core helper functions for the Pritunl VPN client. Disabling this service will prevent the Pritunl client from functioning correctly.'", |
| 84 | + " StartupType = 'Automatic'", |
| 85 | + "}", |
| 86 | + "New-Service @service_config | Out-Null", |
| 87 | + "$failure_actions = [byte[]](", |
| 88 | + " 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,", |
| 89 | + " 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb8, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,", |
| 90 | + " 0x88, 0x13, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x88, 0x13, 0x00, 0x00", |
| 91 | + ")", |
| 92 | + "$registry_path = \"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\$service_name\"", |
| 93 | + "Set-ItemProperty -Path $registry_path -Name 'FailureActions' -Value $failure_actions", |
| 94 | + "Set-ItemProperty -Path $registry_path -Name 'FailureActionsOnNonCrashFailures' -Value 1", |
| 95 | + "Start-Service -Name $service_name -ErrorAction SilentlyContinue" |
| 96 | + ], |
25 | 97 | "bin": [ |
26 | | - [ |
27 | | - "pritunl.exe", |
28 | | - "pritunl", |
29 | | - "--no-main" |
30 | | - ] |
| 98 | + "pritunl.exe", |
| 99 | + "pritunl-client.exe" |
31 | 100 | ], |
32 | 101 | "shortcuts": [ |
33 | 102 | [ |
34 | 103 | "pritunl.exe", |
35 | 104 | "Pritunl" |
36 | 105 | ] |
37 | 106 | ], |
38 | | - "checkver": "([\\d.]+)/Pritunl.exe", |
| 107 | + "pre_uninstall": "if (-not (is_admin)) { abort \"`n[ERROR] $app requires admin rights to $cmd.\" }", |
| 108 | + "uninstaller": { |
| 109 | + "script": [ |
| 110 | + "Stop-Service -Name 'pritunl' -Force -ErrorAction SilentlyContinue", |
| 111 | + "Stop-Process -Name 'pritunl', 'pritunl-service' -Force -ErrorAction SilentlyContinue", |
| 112 | + "Start-Sleep -Milliseconds 1500", |
| 113 | + "if ($cmd -ne 'uninstall') { return }", |
| 114 | + "if ($PSVersionTable.PSVersion -lt [Version]::new(6, 0)) {", |
| 115 | + " Start-Process -FilePath 'sc.exe' -ArgumentList @('delete', 'pritunl') -NoNewWindow -Wait", |
| 116 | + "} else {", |
| 117 | + " Remove-Service -Name 'pritunl' -ErrorAction SilentlyContinue", |
| 118 | + "}" |
| 119 | + ] |
| 120 | + }, |
| 121 | + "checkver": { |
| 122 | + "github": "https://github.com/pritunl/pritunl-client-electron" |
| 123 | + }, |
39 | 124 | "autoupdate": { |
40 | | - "architecture": { |
41 | | - "64bit": { |
42 | | - "url": "https://github.com/pritunl/pritunl-client-electron/releases/download/$version/Pritunl.exe#/dl.exe", |
43 | | - "hash": { |
44 | | - "url": "https://raw.githubusercontent.com/pritunl/pritunl-client-electron/master/SHA256", |
45 | | - "regex": "$version[\\r\\n]+$sha256.*?$basename" |
46 | | - } |
47 | | - } |
| 125 | + "url": "https://github.com/pritunl/pritunl-client-electron/releases/download/$version/Pritunl.exe#/dl.exe", |
| 126 | + "hash": { |
| 127 | + "url": "https://raw.githubusercontent.com/pritunl/pritunl-client-electron/HEAD/SHA512", |
| 128 | + "regex": "(?s)$version.+?$sha512.+?$basename" |
48 | 129 | } |
49 | 130 | } |
50 | 131 | } |
0 commit comments