LSPosed / MagiskOnWSALocal

Integrate Magisk root and Google Apps into WSA (Windows Subsystem for Android)
GNU Affero General Public License v3.0
9.6k stars 23.12k forks source link

Script shouldn't install Magisk app when Root Solution is set to "none" #314

Closed zanhecht closed 1 year ago

zanhecht commented 1 year ago

Steps to reproduce/复现步骤

  1. Run run.sh
  2. Choose "none" for root solution

Expected behaviour/预期行为

The script should either have "none" as an option for "Magisk version", or it should ask for the root solution before asking which version of Magisk to download and then skip asking which version of Magisk to use if "none" is selected.

Actual behaviour/实际行为

Magisk app is still installed even if the android image is not rooted

MagiskOnWSALocal commit full SHA/MagiskOnWSALocal 提交的完整哈希

39d51aaf4481ba8bd78965f57383556cc2b8261f

Linux distribution info/Linux 发行版信息

Debian GNU/Linux 11 (bullseye)

Windows version/Windows 版本

10.0.19045

Build Parameters/构建参数

COMMAND_LINE=--arch x64 --release-type WIS --magisk-ver stable --gapps-brand OpenGApps --gapps-variant pico --root-sol none --compress-format INFO: Architecture: x64 INFO: Release Type: WIS INFO: Magisk Version: stable INFO: GApps Brand: OpenGApps INFO: GApps Variant: pico INFO: Root Solution: none Build: RELEASE_TYPE=Insider Slow

Version requirement/版本要求

Logs/日志

Details ``` COMMAND_LINE=--arch x64 --release-type WIS --magisk-ver stable --gapps-brand OpenGApps --gapps-variant pico --root-sol none --compress-format INFO: Architecture: x64 INFO: Release Type: WIS INFO: Magisk Version: stable INFO: GApps Brand: OpenGApps INFO: GApps Variant: pico INFO: Root Solution: none Build: RELEASE_TYPE=Insider Slow Generate Download Links Generating WSA download link: arch=x64 release_type=Insider Slow download link: http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/605edfa0-3ba9-423b-abb2-aa8da0b0e8f2?P1=1672163718&P2=404&P3=2&P4=iFVBqyym3bNKk8ohfSMgbtUDFVRKQR40RuHYf%2bzEtBdizzBIr3NHvCIvUaQG6hvD9YsZzfY8W%2ffIFTyq0f6FMw%3d%3d to /home/ahecht/MagiskOnWSALocal/download/Microsoft.UI.Xaml_x64.appx WSA Version=2210.40000.7.0 download link: http://tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/15af34f3-b0f6-42bb-9e95-19888b0c545c?P1=1672191394&P2=404&P3=2&P4=akSq5yPIM2Sg41Lay8tDIaCU%2bqjyktCn2t5gFGm2MF52YgbvrgzvH%2fFFDM9FHNPyLYTaNH%2b62lEHpveUid4UpA%3d%3d to /home/ahecht/MagiskOnWSALocal/download/wsa-WIS.zip Generating Magisk download link: release type=stable download link: https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files@25.2/app-release.apk Generating OpenGApps download link: arch=x64 variant=pico DATE=20220503 download link: https://downloads.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip Download Artifacts 12/27 12:43:57 [NOTICE] Downloading 5 item(s) 12/27 12:43:57 [NOTICE] CUID#9 - Redirecting to https://download.microsoft.com/download/4/7/c/47c6134b-d61f-4024-83bd-b9c9ea951c25/appx/Microsoft.VCLibs.x64.14.00.Desktop.appx 12/27 12:43:57 [NOTICE] CUID#11 - Redirecting to https://netactuate.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip [DL:35MiB][#668d40 4.4MiB/4.6MiB(95%)][#a7beee 53MiB/1.3GiB(3%)][#b01dbb 1.3MiB/6.3MiB(21%)][#7b24f0 6.1MiB/10MiB(57%)] 12/27 12:43:59 [NOTICE] Download complete: /home/ahecht/MagiskOnWSALocal/download/Microsoft.UI.Xaml_x64.appx 12/27 12:43:59 [NOTICE] CUID#51 - Redirecting to https://gigenet.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip 12/27 12:43:59 [NOTICE] Download complete: /home/ahecht/MagiskOnWSALocal/download/magisk-stable.zip [DL:36MiB][#a7beee 113MiB/1.3GiB(8%)][#b01dbb 4.3MiB/6.3MiB(68%)][#ac8fe4 4.6MiB/117MiB(3%)] 12/27 12:44:01 [NOTICE] CUID#53 - Redirecting to https://phoenixnap.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip [DL:36MiB][#a7beee 134MiB/1.3GiB(9%)][#b01dbb 5.6MiB/6.3MiB(89%)][#ac8fe4 18MiB/117MiB(15%)] 12/27 12:44:02 [NOTICE] CUID#53 - Redirecting to https://downloads.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip?download&failedmirror=phoenixnap.dl.sourceforge.net 12/27 12:44:02 [NOTICE] Download complete: /home/ahecht/MagiskOnWSALocal/download/Microsoft.VCLibs.x64.14.00.Desktop.appx [DL:36MiB][#a7beee 157MiB/1.3GiB(11%)][#ac8fe4 31MiB/117MiB(26%)] 12/27 12:44:03 [NOTICE] CUID#52 - Redirecting to https://gigenet.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip [DL:36MiB][#a7beee 219MiB/1.3GiB(15%)][#ac8fe4 41MiB/117MiB(35%)] 12/27 12:44:05 [NOTICE] CUID#53 - Redirecting to https://netactuate.dl.sourceforge.net/project/opengapps/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip [DL:36MiB][#a7beee 325MiB/1.3GiB(23%)][#ac8fe4 115MiB/117MiB(98%)] 12/27 12:44:10 [NOTICE] Download complete: /home/ahecht/MagiskOnWSALocal/download/OpenGApps-x64-11.0-pico.zip [#a7beee 1.3GiB/1.3GiB(98%) CN:2 DL:36MiB] 12/27 12:44:39 [NOTICE] Download complete: /home/ahecht/MagiskOnWSALocal/download/wsa-WIS.zip Download Results: gid |stat|avg speed |path/URI ======+====+===========+======================================================= 668d40|OK | 2.3MiB/s|/home/ahecht/MagiskOnWSALocal/download/Microsoft.UI.Xaml_x64.appx 7b24f0|OK | 4.3MiB/s|/home/ahecht/MagiskOnWSALocal/download/magisk-stable.zip b01dbb|OK | 1.2MiB/s|/home/ahecht/MagiskOnWSALocal/download/Microsoft.VCLibs.x64.14.00.Desktop.appx ac8fe4|OK | 9.9MiB/s|/home/ahecht/MagiskOnWSALocal/download/OpenGApps-x64-11.0-pico.zip a7beee|OK | 32MiB/s|/home/ahecht/MagiskOnWSALocal/download/wsa-WIS.zip Status Legend: (OK):download completed. Extract WSA unzipping to /tmp/wsa-build-ex18c6cqYb_/wsa unzipping from /tmp/wsa-build-ex18c6cqYb_/wsa/WsaPackage_2210.40000.7.0_x64_Release-Nightly.msix Extract done Extract Magisk Magisk version: 25.2 (25200) done Extract OpenGApps Extract done Expand images system_ext: 84/96 files (1.2% non-contiguous), 33731/33833 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system_ext.img to 37316 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system_ext.img is now 37316 (4k) blocks long. product: 148/192 files (0.0% non-contiguous), 82685/82934 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/product.img to 86989 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/product.img is now 86989 (4k) blocks long. /: 2679/2688 files (0.4% non-contiguous), 211652/226948 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system.img to 309904 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system.img is now 309904 (4k) blocks long. vendor: 1320/1344 files (0.6% non-contiguous), 81020/81265 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/vendor.img to 85444 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/vendor.img is now 85444 (4k) blocks long. Expand images done Mount images done Add device administration features done Merge Language Resources Index Pass Completed. AlternateForm Qualifiers: LIGHTUNPLATED,UNPLATED Language Qualifiers: EN-US,EN-GB,AF-ZA,AR-SA,AZ-LATN-AZ,BG-BG,BS-LATN-BA,CA-ES,CS-CZ,CY-GB,DA-DK,DE-DE,EL-GR,ES-ES,ES-MX ,ET-EE,EU-ES,FA-IR,FI-FI,FR-CA,FR-FR,GL-ES,HE-IL,HI-IN,HR-HR,HU-HU,ID-ID,IS-IS,IT-IT,JA-JP,KA-GE,KK-KZ,KO-KR,LT-LT,LV-LV ,MS-MY,NB-NO,NL-NL,NN-NO,PL-PL,PT-BR,PT-PT,QPS-PLOC,QPS-PLOCA,QPS-PLOCM,RO-RO,RU-RU,SL-SI,SQ-AL,SR-CYRL-RS,SR-LATN-RS,SV -SE,TH-TH,TR-TR,UK-UA,VI-VN,ZH-CN,ZH-TW Scale Qualifiers: 200,400,150,125,100 TargetSize Qualifiers: 256,16,20,24,30,32,36,40,48,60,64,72,80,96 Finished building Version: 1.0 Resource Map Name: MicrosoftCorporationII.WindowsSubsystemForAndroid Named Resources: 274 Resource Candidates: 12684 Successfully Completed Merge Language Resources done Add extra packages Add extra packages done Integrate OpenGApps Integrate OpenGApps done Fix OpenGApps prop fixing /tmp/wsa-build-ex18c6cqYb_/system/system/build.prop fixing /tmp/wsa-build-ex18c6cqYb_/system/vendor/build.prop fixing /tmp/wsa-build-ex18c6cqYb_/system/vendor/odm/etc/build.prop done Umount images done Shrink images /: 2733/3840 files (0.6% non-contiguous), 284395/309904 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system.img to 284418 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system.img is now 284418 (4k) blocks long. vendor: 1320/1344 files (0.6% non-contiguous), 81021/85444 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/vendor.img to 81029 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/vendor.img is now 81029 (4k) blocks long. product: 150/192 files (0.0% non-contiguous), 82693/86989 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/product.img to 82701 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/product.img is now 82701 (4k) blocks long. system_ext: 84/96 files (1.2% non-contiguous), 33731/37316 blocks resize2fs 1.46.2 (28-Feb-2021) Resizing the filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system_ext.img to 33738 (4k) blocks. The filesystem on /tmp/wsa-build-ex18c6cqYb_/wsa/x64/system_ext.img is now 33738 (4k) blocks long. Shrink images done Remove signature and add scripts # Automated Install script by Midonei $Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA..." function Test-Administrator { [OutputType([bool])] param() process { [Security.Principal.WindowsPrincipal]$user = [Security.Principal.WindowsIdentity]::GetCurrent(); return $user.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator); } } function Get-InstalledDependencyVersion { param ( [string]$Name, [string]$ProcessorArchitecture ) process { return Get-AppxPackage -Name $Name | ForEach-Object { if ($_.Architecture -eq $ProcessorArchitecture) { $_ } } | Sort-Object -Property Version | Select-Object -ExpandProperty Version -Last 1; } } function Finish { Clear-Host Start-Process "wsa://com.topjohnwu.magisk" Start-Process "wsa://com.android.vending" } If (-Not (Test-Administrator)) { Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force $proc = Start-Process -PassThru -WindowStyle Hidden -Verb RunAs ConHost.exe -Args "powershell -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'); } exit } ElseIf (($args.Count -Eq 1) -And ($args[0] -Eq "EVAL")) { Start-Process ConHost.exe -Args "powershell -ExecutionPolicy Bypass -Command Set-Location '$PSScriptRoot'; &'$PSCommandPath'" exit } If (((Test-Path -Path "Fonts","product.img","WsaSettingsBroker","WsaClient","resources.pri","WsaSettings.exe","wslcoredeps.dll","AppxManifest.xml","lxutil.dll","system.img","WsaProxy","appcompatdb.json","WSACrashUploader","Microsoft.UI.Xaml.winmd","Registry.dat","WsaService","appcompatdb_schema.json","Microsoft.VCLibs.x64.14.00.Desktop.appx","classicAppInstaller_WSA.sccd","WsaSettings.winmd","vendor.img","networking.json","GSKServer","system_ext.img","wslcore.dll","CustomInstall","Tools","Licenses","networking_schema.json","userdata.vhdx","WSACodecs.dll","Microsoft.UI.Xaml_x64.appx","Images","gfxstream_backend.dll","libGLESv2.dll","wslhost.exe","metadata.vhdx","Assets","wsldevicehost.dll","libEGL.dll","Styles") -Eq $false).Count) { 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') exit 1 } reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1" If ($(Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform').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 } } [xml]$Xml = Get-Content ".\AppxManifest.xml"; $Name = $Xml.Package.Identity.Name; $ProcessorArchitecture = $Xml.Package.Identity.ProcessorArchitecture; $Dependencies = $Xml.Package.Dependencies.PackageDependency; $Dependencies | ForEach-Object { If ($_.Name -Eq "Microsoft.VCLibs.140.00.UWPDesktop") { $HighestInstalledVCLibsVersion = Get-InstalledDependencyVersion -Name $_.Name -ProcessorArchitecture $ProcessorArchitecture; If ( $HighestInstalledVCLibsVersion -Lt $_.MinVersion ) { Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path "Microsoft.VCLibs.$ProcessorArchitecture.14.00.Desktop.appx" } } ElseIf ($_.Name -Match "Microsoft.UI.Xaml") { $HighestInstalledXamlVersion = Get-InstalledDependencyVersion -Name $_.Name -ProcessorArchitecture $ProcessorArchitecture; If ( $HighestInstalledXamlVersion -Lt $_.MinVersion ) { Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path "Microsoft.UI.Xaml_$ProcessorArchitecture.appx" } } } $Installed = $null $Installed = Get-AppxPackage -Name $Name If (($null -Ne $Installed) -And (-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) { Remove-AppxPackage -Package $Installed.PackageFullName } Else { exit 1 } } Clear-Host Write-Host "Installing MagiskOnWSA..." Stop-Process -Name "WsaClient" -ErrorAction SilentlyContinue Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml If ($?) { Finish } ElseIf ($null -Ne $Installed) { Clear-Host Write-Host "Failed to update, try to uninstall existing installation while preserving userdata..." Remove-AppxPackage -PreserveApplicationData -Package $Installed.PackageFullName Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml If ($?) { Finish } } Write-Host "All Done!`r`nPress any key to exit" $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown') :: 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 -ExecutionPolicy Bypass -File .\Install.ps1 exit ) Remove signature and add scripts done Generate info WSA_2210.40000.7.0_x64_Release-Nightly-OpenGApps-11.0-pico Finishing building.... done Cleanup Work Directory done ```
Howard20181 commented 1 year ago

Expected. gapps needs additional SEPolicy to work properly, so we need to use Magisk's policy loading feature even if we choose root solution as none.