{
    "##": "'rootfs' must be a 'real' directory (at least on Windows 10 RS4)",
    "version": "26.4.2.0",
    "description": "Install ArchLinux as a WSL Instance",
    "homepage": "https://github.com/yuk7/ArchWSL",
    "license": "MIT",
    "notes": [
        "Even when you are logging in as 'root', some operations (like service command) require Windows administrator privileges",
        "Arch Linux now provides an official WSL image. See: https://wiki.archlinux.org/title/Install_Arch_Linux_on_WSL"
    ],
    "url": "https://github.com/yuk7/ArchWSL/releases/download/26.4.2.0/Arch.zip",
    "hash": "c0a6edebb4687f3c4204ddf441e844b2cb6be3a2f9db6259b80d52164a5677fb",
    "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 ArchWSL.'",
        "    $installable = $false",
        "}",
        "& \"$dir\\Arch.exe\" 'isregd'",
        "if ($?) {",
        "    warn 'ArchWsl is already registered'",
        "    $installable = $false",
        "}",
        "if ($installable) {",
        "    Copy-Item \"$dir\\Arch.exe\" \"$persist_dir\\data\\Arch.exe\"",
        "    $res = Invoke-ExternalCommand \"$persist_dir\\data\\Arch.exe\" 'install', \"$dir\\rootfs.tar.gz\"",
        "    Remove-Item \"$persist_dir\\data\\Arch.exe\" -Force",
        "    if(!$res) { error 'ArchWsl installation failed!'; return }",
        "}",
        "Remove-Item \"$dir\\rootfs.tar.gz\" -Force"
    ],
    "uninstaller": {
        "script": [
            "if ($cmd -ne 'uninstall') { return }",
            "$res = Invoke-ExternalCommand \"$dir\\Arch.exe\" 'isregd'",
            "if(!$res) { error 'ArchWsl is not registered!'; return }",
            "Invoke-ExternalCommand \"$dir\\Arch.exe\" 'clean', '-y' | Out-Null"
        ]
    },
    "bin": "Arch.exe",
    "shortcuts": [
        [
            "Arch.exe",
            "Arch Linux"
        ]
    ],
    "persist": "data",
    "checkver": "github",
    "autoupdate": {
        "url": "https://github.com/yuk7/ArchWSL/releases/download/$version/Arch.zip"
    }
}
