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: |

View File

@ -9,6 +9,7 @@
- Fix external storage access of DocumentUI
- Unatended installation
- Automatically activates developers mode in Windows 11
- Update to new version while preserving data with one-click script
## Usage
@ -23,8 +24,10 @@
![Run Workflow](https://docs.github.com/assets/images/actions-manually-run-workflow.png)
1. Wait for the action to complete and download the artifact
![Download](https://docs.github.com/assets/images/help/repository/artifact-drop-down-updated.png)
1. Unzip the artifact and uninstall WSA if you have an official installation or replace the previously unzipped artifact if you have a manual installation
1. Unzip the artifact
- If you have an official WSA installation, you should uninstall it first. (In case you want to preserve your data, you can backup `%LOCALAPPDATA%\Packages\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe\LocalCache\userdata.vhdx` before uninstallation and restore it after installation.)
1. Right-click `Install.ps1` and select `Run with PowerShell`
- If you previously have a MagiskOnWSA installation, it will automatically uninstall the previous while **preserving all userdata** and install the new one, so don't worry about your data.
1. Enjoy by installing LSPosed-zygisk with zygisk enabled or Riru and LSPosed-riru
## Video Demo