{
    "##": "Renaming .msi to .msi_ to avoid auto extraction",
    "version": "2.7.4-I001",
    "description": "A flexible virtual private network (VPN) solution to secure data communications.",
    "homepage": "https://openvpn.net",
    "license": "GPL-2.0-only",
    "suggest": {
        "openssl": [
            "openssl",
            "openssl-light"
        ]
    },
    "architecture": {
        "64bit": {
            "url": "https://swupdate.openvpn.org/community/releases/OpenVPN-2.7.4-I001-amd64.msi#/setup.msi_",
            "hash": "7b70d592b421c20744d704d66a9c7b0c0fff6b23c76a90f6ab52d9d2cecfaf25"
        },
        "32bit": {
            "url": "https://swupdate.openvpn.org/community/releases/OpenVPN-2.7.4-I001-x86.msi#/setup.msi_",
            "hash": "2612761d78a76e7acde992123922325e501f07e22d97fcb9dc1cfccb29739555"
        },
        "arm64": {
            "url": "https://swupdate.openvpn.org/community/releases/OpenVPN-2.7.4-I001-arm64.msi#/setup.msi_",
            "hash": "c7c02ab04d0769213f358ef71e250e8c1c44a4c8bca2bc5cfdfe198bb3dd7d5b"
        }
    },
    "pre_install": [
        "if ([Environment]::OSVersion.Version.Major -lt 10) { error 'Windows 10 is required since version 2.4.8. Use \"versions/openvpn-w7\" instead'; break }",
        "if (-not (is_admin)) { error 'Administrator privileges are needed for installation'; break }",
        "Invoke-ExternalCommand msiexec -ArgumentList @('/i', \"`\"$dir\\setup.msi_`\"\", \"PRODUCTDIR=`\"$dir`\"\", 'ADDLOCAL=OpenVPN.GUI,OpenVPN.Service,OpenVPN.Documentation,OpenVPN.SampleCfg,OpenSSL,EasyRSA,OpenVPN,OpenVPN.GUI.OnLogon,Drivers.TAPWindows6,Drivers,Drivers.OvpnDco', '/passive') -RunAs | Out-Null",
        "Remove-Item \"$Env:Public\\Desktop\\OpenVPN*.lnk\""
    ],
    "post_install": [
        "# Persist manually because the uninstaller deletes the 'config' and 'config-auto' folder",
        "'config', 'config-auto' | ForEach-Object {",
        "    if (Test-Path -Path \"$persist_dir\\$_\") {",
        "        Copy-Item -Path \"$persist_dir\\$_\" -Destination $dir -Force -Recurse",
        "    }",
        "}",
        "if (-not (Test-Path -Path \"$persist_dir\\config\")) {",
        "    Copy-Item -Path \"$dir\\sample-config\\*\" -Destination \"$dir\\config\\\" -Force -Recurse",
        "}"
    ],
    "pre_uninstall": [
        "# Persist manually because the uninstaller deletes the 'config' and 'config-auto' folder",
        "'config', 'config-auto' | ForEach-Object {",
        "    if (Test-Path -Path \"$dir\\$_\") {",
        "        ensure $persist_dir | Out-Null",
        "        Copy-Item -Path \"$dir\\$_\" -Destination $persist_dir -Force -Recurse",
        "    }",
        "}",
        "Stop-Process -Name 'openvpn*' -Force -ErrorAction SilentlyContinue"
    ],
    "uninstaller": {
        "script": [
            "if (-not (is_admin)) { error 'Admin privileges are needed.'; break }",
            "Invoke-ExternalCommand msiexec -ArgumentList ('/x', \"`\"$dir\\setup.msi_`\"\", '/passive') -RunAs | Out-Null"
        ]
    },
    "bin": "bin\\openvpn.exe",
    "checkver": {
        "url": "https://openvpn.net/index.php/open-source/downloads.html",
        "regex": "OpenVPN-([\\d.]+-I[\\d]+)-amd64\\.msi"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://swupdate.openvpn.org/community/releases/OpenVPN-$version-amd64.msi#/setup.msi_"
            },
            "32bit": {
                "url": "https://swupdate.openvpn.org/community/releases/OpenVPN-$version-x86.msi#/setup.msi_"
            },
            "arm64": {
                "url": "https://swupdate.openvpn.org/community/releases/OpenVPN-$version-arm64.msi#/setup.msi_"
            }
        }
    }
}
