Enable VirtualPlatform

This commit is contained in:
LoveSy 2021-12-12 08:47:30 +08:00
parent 9da5349c42
commit 46f1df7fe8

View File

@ -53,8 +53,6 @@ jobs:
out_file = "xaml.appx"
if not os.path.isfile(out_file):
urllib.request.urlretrieve(link, out_file)
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f'XAML_NAME={a.string.split("_", 1)[0]}\n')
a = html.find("a", string=re.compile(f"Microsoft\.VCLibs\..*_{arch}_.*\.appx"))
link = a["href"]
@ -62,8 +60,6 @@ jobs:
out_file = "vclibs.appx"
if not os.path.isfile(out_file):
urllib.request.urlretrieve(link, out_file)
with open(os.environ['GITHUB_ENV'], 'a') as f:
f.write(f'VCLIB_NAME={a.string.split("_", 1)[0]}\n')
a = html.find("a", string=re.compile("MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle"))
link = a["href"]
@ -435,6 +431,7 @@ jobs:
\$proc = Start-Process -PassThru -WindowStyle Hidden -Verb RunAs powershell.exe -Args "-executionpolicy bypass -command Set-Location \`"\$PSScriptRoot\`"; \`"\$PSCommandPath\`" EVAL"
\$proc.WaitForExit()
if (\$proc.ExitCode -ne 0) {
Clear-Host
Write-Warning "Failed to launch start as Administrator\`r\`nPress any key to exit"
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}
@ -447,25 +444,29 @@ jobs:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
\$Installed = \$null
\$Installed = Get-AppxPackage -Name '$XAML_NAME'
If (\$null -eq \$Installed) {
Add-AppxPackage -Path xaml.appx
\$VMP = Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform'
if (\$VMP.State -ne "Enabled") {
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName 'VirtualMachinePlatform'
Clear-Host
Write-Warning "Need restart to enable virtual machine platform\`r\`nPress y to restart or press any key to exit"
\$key = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
If ("y" -eq \$key.Character) {
Restart-Computer -Confirm
}
Else {
exit 1
}
}
\$Installed = \$null
\$Installed = Get-AppxPackage -Name '$VCLIB_NAME'
If (\$null -eq \$Installed) {
Add-AppxPackage -Path vclibs.appx
}
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path vclibs.appx
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path xaml.appx
\$Installed = \$null
\$Installed = Get-AppxPackage -Name 'MicrosoftCorporationII.WindowsSubsystemForAndroid'
If (\$null -ne \$Installed) {
If (-not (\$Installed.IsDevelopmentMode)) {
Clear-Host
Write-Warning "There is already one installed WSA. Please uninstall it first.\`r\`nPress y to uninstall existing WSA or press any key to exit"
\$key = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
If ("y" -eq \$key.Character) {
@ -476,13 +477,15 @@ jobs:
}
}
Else {
Clear-Host
Write-Host "Uninstalling existing installation while preserving userdata..."
Remove-AppxPackage -PreserveApplicationData -Package \$Installed.PackageFullName
}
}
Clear-Host
Write-Host "Installing MagiskOnWSA..."
Add-AppxPackage -Register .\AppxManifest.xml
Clear-Host
EOF
- name: Generate artifact name
run: |