Update script and readme

This commit is contained in:
LoveSy
2021-12-12 01:56:48 +08:00
parent 5255ce5fca
commit 83557639ba
2 changed files with 43 additions and 7 deletions

View File

@@ -376,8 +376,7 @@ jobs:
tee ${{ matrix.arch }}/Install.ps1 <<EOF
# Automated Install script by Mioki
# http://github.com/okibcn
function Test-Administrator
{
function Test-Administrator {
[OutputType([bool])]
param()
process {
@@ -386,14 +385,48 @@ jobs:
}
}
if(-not (Test-Administrator))
{
Start-Process -Verb RunAs powershell.exe -Args "-executionpolicy bypass -command Set-Location \`"\$PSScriptRoot\`"; \`"\$PSCommandPath\`""
if (-not (Test-Administrator)) {
\$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) {
Write-Warning "Failed to launch start as Administrator\`r\`nPress any key to exit"
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}
exit
}
\$ErrorActionPreference = "Stop"
elseif ((\$args.Count -eq 1) -and (\$args[0] -eq "EVAL")) {
Start-Process powershell.exe -Args "-executionpolicy bypass -command Set-Location \`"\$PSScriptRoot\`"; \`"\$PSCommandPath\`""
exit
}
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
\$Installed = \$null
\$Installed = Get-AppxPackage Name 'MicrosoftCorporationII.WindowsSubsystemForAndroid'
If (\$null -ne \$Installed) {
If (-not (\$Installed.IsDevelopmentMode)) {
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) {
Remove-AppxPackage -Package \$Installed.PackageFullName
}
Else {
exit 1
}
}
Else {
Write-Host "Uninstalling existing installation while preserving userdata..."
Remove-AppxPackage -PreserveApplicationData -Package \$Installed.PackageFullName
}
}
Write-Host "Installing MagiskOnWSA..."
Add-AppxPackage -Register .\AppxManifest.xml
Start-Process "wsa://com.topjohnwu.magisk"
Write-Host "All Done\`r\`nPress any key to exit"
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
EOF
- name: Generate artifact name
run: |