forked from ScoopInstaller/Extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archwsl.json
72 lines (72 loc) · 3.61 KB
/
archwsl.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
"homepage": "https://github.com/yuk7/ArchWSL/",
"description": "Install ArchLinux as a WSL Instance",
"notes": "Even when you are logging in as 'root', some operations (like service command) require Windows administrator privileges",
"version": "19010200",
"url": "https://github.com/yuk7/ArchWSL/releases/download/19010200/Arch.zip",
"hash": "29f0152a50f3a8cc2a864450ae68b83c0168c1d48b4169369fcc4afea4c1fbf8",
"checkver": {
"url": "https://api.github.com/repos/yuk7/ArchWSL/releases/latest",
"jp": "$.tag_name"
},
"autoupdate": {
"url": "https://github.com/yuk7/ArchWSL/releases/download/$version/Arch.zip"
},
"bin": "Arch.exe",
"shortcuts": [
[
"Arch.exe",
"Arch Linux"
]
],
"##": "'rootfs' must be a 'real' directory (at least on Windows 10 RS4)",
"persist": "data",
"post_install": [
"$installable = $true",
"$user = [Security.Principal.WindowsIdentity]::GetCurrent() -as [Security.Principal.WindowsPrincipal]",
"$permission = Get-Acl $dir | select -ExpandProperty Access | where {",
" ($user.IsInRole($_.IdentityReference)) -and `",
" ($_.FileSystemRights.ToString() -eq 'FullControl') -and `",
" # 3 = ([Security.AccessControl.InheritanceFlags]::ContainerInherit -bor ObjectInherit)",
" ($_.InheritanceFlags -band 3) -and `",
" ($_.PropagationFlags.ToString() -ne 'NoPropagateInherit')",
"}",
"if ($null -eq $permission) {",
" warn \"Full Control access to the scoop directory is necessary to install WSL distribution.\"",
" warn \"Change directory security and reinstall ArchWSL.\"",
" $installable = $false",
"}",
"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",
"}",
"if ($installable) {",
" \"`$si = New-Object System.Diagnostics.ProcessStartInfo '$dir\\Arch.exe' -Property @{ UseShellExecute = `$false; RedirectStandardInput = `$true }",
" `$p = [System.Diagnostics.Process]::Start(`$si)",
" `$p.StandardInput.Write('y')",
" `$p.WaitForExit()",
" `$lx_uid = & '$dir\\Arch.exe' get --lxuid",
" if(!`$lx_uid) { error 'ArchWsl is not installed!'; return }",
" Set-ItemProperty -Path ('HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\Lxss\\' + `$lx_uid) -Name BasePath -Value '$persist_dir\\data'",
" if (Test-Path ('$persist_dir' + '\\data\\rootfs')) {",
" Remove-Item -Recurse -Path '$dir\\rootfs'",
" } else {",
" Move-Item -Path '$dir\\rootfs' -Destination '$persist_dir\\data\\rootfs'",
" }",
" Remove-Item -Recurse -Path '$dir\\temp'",
" \" | Set-Content \"$dir\\install.ps1\"",
" & \"$dir\\install.ps1\"",
"}"
],
"uninstaller": {
"script": [
"$lx_uid = & \"$dir\\Arch.exe\" get --lxuid",
"if(!$lx_uid) { error 'ArchWsl is not registered!'; return }",
"Set-ItemProperty -Path \"HKCU:Software\\Microsoft\\Windows\\CurrentVersion\\Lxss\\$lx_uid\" -Name BasePath -Value $dir",
"New-Item -ItemType Directory -Path \"$dir\\rootfs\" | Out-Null",
"'y' | & \"$dir\\Arch.exe\" clean"
]
}
}