{
    "##": "'rootfs' must be a 'real' directory (at least on Windows 10 RS4)",
    "version": "3.23.3-0",
    "description": "Install AlpineWSL as a WSL Instance",
    "homepage": "https://github.com/yuk7/AlpineWSL",
    "license": "MIT",
    "notes": "Even when you are logging in as 'root', some operations (like service command) require Windows administrator privileges",
    "url": "https://github.com/yuk7/AlpineWSL/releases/download/3.23.3-0/Alpine.zip",
    "hash": "d9f8683602c8698955d1bf51c30d50be52b4f979e4cb63f6188adc28e7cf900f",
    "post_install": [
        "$installable = $true",
        "if ($null -eq (Get-Command 'wslconfig' -ErrorAction SilentlyContinue)) {",
        "    warn 'WSL appears not to be enabled!'",
        "    warn 'Run ''Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux'''",
        "    warn 'from an elevated PowerShell. Restart your computer when prompted and reinstall AlpineWSL.'",
        "    $installable = $false",
        "}",
        "& \"$dir\\Alpine.exe\" 'isregd'",
        "if ($?) {",
        "    warn 'AlpineWsl is already registered'",
        "    $installable = $false",
        "}",
        "if ($installable) {",
        "    Copy-Item \"$dir\\Alpine.exe\" \"$persist_dir\\data\\Alpine.exe\"",
        "    $res = Invoke-ExternalCommand \"$persist_dir\\data\\Alpine.exe\" 'install', \"$dir\\rootfs.tar.gz\"",
        "    Remove-Item \"$persist_dir\\data\\Alpine.exe\" -Force",
        "    if(!$res) { error 'AlpineWSL installation failed!'; return }",
        "}",
        "Remove-Item \"$dir\\rootfs.tar.gz\" -Force"
    ],
    "uninstaller": {
        "script": [
            "if ($cmd -ne 'uninstall') { return }",
            "$res = Invoke-ExternalCommand \"$dir\\Alpine.exe\" 'isregd'",
            "if(!$res) { error 'AlpineWSL is not registered!'; return }",
            "Invoke-ExternalCommand \"$dir\\Alpine.exe\" 'clean', '-y' | Out-Null"
        ]
    },
    "bin": "Alpine.exe",
    "shortcuts": [
        [
            "Alpine.exe",
            "Alpine Linux"
        ]
    ],
    "persist": "data",
    "checkver": {
        "url": "https://github.com/yuk7/AlpineWSL/releases/latest",
        "regex": "/releases/tag/(?:v|V)?([\\d.]+(-\\d+)?)"
    },
    "autoupdate": {
        "url": "https://github.com/yuk7/AlpineWSL/releases/download/$version/Alpine.zip"
    }
}
