mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-23 11:49:16 +01:00
Add batch script (#116)
Co-authored-by: Howard Wu <40033067+Howard20181@users.noreply.github.com>
This commit is contained in:
parent
823f1895d0
commit
08fbb8d9dc
@ -54,7 +54,7 @@
|
|||||||
1. Select the root solution (none means no root)
|
1. Select the root solution (none means no root)
|
||||||
1. Wait for the script to complete and the artifact will be in the `output` folder
|
1. Wait for the script to complete and the artifact will be in the `output` folder
|
||||||
1. Move the artifact to a place you like
|
1. Move the artifact to a place you like
|
||||||
1. Right-click `Install.ps1` and select `Run with PowerShell`
|
1. Double-click `Run.bat`
|
||||||
- If you previously have a MagiskOnWSA installation, it will automatically uninstall the previous one while **preserving all user data** and install the new one, so don't worry about your data.
|
- If you previously have a MagiskOnWSA installation, it will automatically uninstall the previous one while **preserving all user data** and install the new one, so don't worry about your data.
|
||||||
- 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.) (If you want to restore the icons to the start menu, please install and use [WSAHelper](https://github.com/LSPosed/WSAHelper/releases/latest).)
|
- 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.) (If you want to restore the icons to the start menu, please install and use [WSAHelper](https://github.com/LSPosed/WSAHelper/releases/latest).)
|
||||||
- If the popup windows disappear **without asking administrative permission** and WSA is not installed successfully, you should manually run `Install.ps1` as administrator:
|
- If the popup windows disappear **without asking administrative permission** and WSA is not installed successfully, you should manually run `Install.ps1` as administrator:
|
||||||
|
@ -658,7 +658,7 @@ sudo rm -rf "${WORK_DIR:?}"/wsa/"$ARCH"/\[Content_Types\].xml "$WORK_DIR"/wsa/"$
|
|||||||
cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR"/wsa/"$ARCH" || abort
|
cp "$vclibs_PATH" "$xaml_PATH" "$WORK_DIR"/wsa/"$ARCH" || abort
|
||||||
tee "$WORK_DIR"/wsa/"$ARCH"/Install.ps1 <<EOF
|
tee "$WORK_DIR"/wsa/"$ARCH"/Install.ps1 <<EOF
|
||||||
# Automated Install script by Midonei
|
# Automated Install script by Midonei
|
||||||
# http://github.com/doneibcn
|
\$Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA..."
|
||||||
function Test-Administrator {
|
function Test-Administrator {
|
||||||
[OutputType([bool])]
|
[OutputType([bool])]
|
||||||
param()
|
param()
|
||||||
@ -674,23 +674,23 @@ function Finish {
|
|||||||
Start-Process "wsa://com.android.vending"
|
Start-Process "wsa://com.android.vending"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Administrator)) {
|
If (-Not (Test-Administrator)) {
|
||||||
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
|
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
|
||||||
\$proc = Start-Process -PassThru -WindowStyle Hidden -Verb RunAs powershell.exe -Args "-executionpolicy bypass -command Set-Location '\$PSScriptRoot'; &'\$PSCommandPath' EVAL"
|
\$proc = Start-Process -PassThru -WindowStyle Hidden -Verb RunAs powershell.exe -Args "-ExecutionPolicy Bypass -Command Set-Location '\$PSScriptRoot'; &'\$PSCommandPath' EVAL"
|
||||||
\$proc.WaitForExit()
|
\$proc.WaitForExit()
|
||||||
if (\$proc.ExitCode -ne 0) {
|
If (\$proc.ExitCode -Ne 0) {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Warning "Failed to launch start as Administrator\`r\`nPress any key to exit"
|
Write-Warning "Failed to launch start as Administrator\`r\`nPress any key to exit"
|
||||||
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
|
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
|
||||||
}
|
}
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
elseif ((\$args.Count -eq 1) -and (\$args[0] -eq "EVAL")) {
|
ElseIf ((\$args.Count -Eq 1) -And (\$args[0] -Eq "EVAL")) {
|
||||||
Start-Process powershell.exe -Args "-executionpolicy bypass -command Set-Location '\$PSScriptRoot'; &'\$PSCommandPath'"
|
Start-Process powershell.exe -Args "-ExecutionPolicy Bypass -Command Set-Location '\$PSScriptRoot'; &'\$PSCommandPath'"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Test-Path -Path $(find "$WORK_DIR"/wsa/"$ARCH" -maxdepth 1 -mindepth 1 -printf "\"%P\"\n" | paste -sd "," -)) -eq \$false).Count) {
|
If (((Test-Path -Path $(find "$WORK_DIR"/wsa/"$ARCH" -maxdepth 1 -mindepth 1 -printf "\"%P\"\n" | paste -sd "," -)) -Eq \$false).Count) {
|
||||||
Write-Error "Some files are missing in the folder. Please try to build again. Press any key to exist"
|
Write-Error "Some files are missing in the folder. Please try to build again. Press any key to exist"
|
||||||
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
exit 1
|
exit 1
|
||||||
@ -698,13 +698,12 @@ if (((Test-Path -Path $(find "$WORK_DIR"/wsa/"$ARCH" -maxdepth 1 -mindepth 1 -pr
|
|||||||
|
|
||||||
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
|
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
|
||||||
|
|
||||||
\$VMP = Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform'
|
If (\$(Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform').State -Ne "Enabled") {
|
||||||
if (\$VMP.State -ne "Enabled") {
|
|
||||||
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName 'VirtualMachinePlatform'
|
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName 'VirtualMachinePlatform'
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Warning "Need restart to enable virtual machine platform\`r\`nPress y to restart or press any key to exit"
|
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')
|
\$key = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
If ("y" -eq \$key.Character) {
|
If ("y" -Eq \$key.Character) {
|
||||||
Restart-Computer -Confirm
|
Restart-Computer -Confirm
|
||||||
}
|
}
|
||||||
Else {
|
Else {
|
||||||
@ -718,11 +717,11 @@ Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path xaml-
|
|||||||
\$Installed = \$null
|
\$Installed = \$null
|
||||||
\$Installed = Get-AppxPackage -Name 'MicrosoftCorporationII.WindowsSubsystemForAndroid'
|
\$Installed = Get-AppxPackage -Name 'MicrosoftCorporationII.WindowsSubsystemForAndroid'
|
||||||
|
|
||||||
If ((\$null -ne \$Installed) -and (-not (\$Installed.IsDevelopmentMode))) {
|
If ((\$null -Ne \$Installed) -And (-Not (\$Installed.IsDevelopmentMode))) {
|
||||||
Clear-Host
|
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"
|
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')
|
\$key = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
If ("y" -eq \$key.Character) {
|
If ("y" -Eq \$key.Character) {
|
||||||
Remove-AppxPackage -Package \$Installed.PackageFullName
|
Remove-AppxPackage -Package \$Installed.PackageFullName
|
||||||
}
|
}
|
||||||
Else {
|
Else {
|
||||||
@ -731,23 +730,37 @@ If ((\$null -ne \$Installed) -and (-not (\$Installed.IsDevelopmentMode))) {
|
|||||||
}
|
}
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Installing MagiskOnWSA..."
|
Write-Host "Installing MagiskOnWSA..."
|
||||||
Stop-Process -Name "wsaclient" -ErrorAction "silentlycontinue"
|
Stop-Process -Name "WsaClient" -ErrorAction SilentlyContinue
|
||||||
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
|
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
|
||||||
if (\$?) {
|
If (\$?) {
|
||||||
Finish
|
Finish
|
||||||
}
|
}
|
||||||
Elseif (\$null -ne \$Installed) {
|
ElseIf (\$null -Ne \$Installed) {
|
||||||
Clear-Host
|
Clear-Host
|
||||||
Write-Host "Failed to update, try to uninstall existing installation while preserving userdata..."
|
Write-Host "Failed to update, try to uninstall existing installation while preserving userdata..."
|
||||||
Remove-AppxPackage -PreserveApplicationData -Package \$Installed.PackageFullName
|
Remove-AppxPackage -PreserveApplicationData -Package \$Installed.PackageFullName
|
||||||
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
|
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
|
||||||
if (\$?) {
|
If (\$?) {
|
||||||
Finish
|
Finish
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Host "All Done\`r\`nPress any key to exit"
|
Write-Host "All Done!\`r\`nPress any key to exit"
|
||||||
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
\$null = \$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
|
||||||
EOF
|
EOF
|
||||||
|
tee "$WORK_DIR"/wsa/"$ARCH"/Run.bat <<EOF
|
||||||
|
:: Automated Install batch script by Syuugo
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
if not exist Install.ps1 (
|
||||||
|
echo "Install.ps1" is not found.
|
||||||
|
echo Press any key to exit
|
||||||
|
pause>nul
|
||||||
|
exit 1
|
||||||
|
) else (
|
||||||
|
start powershell.exe -File .\Install.ps1 -ExecutionPolicy Bypass
|
||||||
|
exit
|
||||||
|
)
|
||||||
|
EOF
|
||||||
echo -e "Remove signature and add scripts done\n"
|
echo -e "Remove signature and add scripts done\n"
|
||||||
|
|
||||||
echo "Generate info"
|
echo "Generate info"
|
||||||
|
Loading…
Reference in New Issue
Block a user