MustardChef / WSABuilds

Run Windows Subsystem For Android on your Windows 10 and Windows 11 PC using prebuilt binaries with Google Play Store (MindTheGapps) and/or Magisk or KernelSU (root solutions) built in.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Install error

bropines opened this issue · comments

Describe the bug

C:\Users\bropi\Programs\WSA_2311.40000.5.0_x64\Install.ps1 :
Some files are missing in the folder.
Please try to build again.
Press any key to exit
строка:1 знак:64
+ ... 0.5.0_x64'; &'C:\Users\USER\Programs\WSA_2311.40000.5.0_x64\Install. ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install.ps1

Steps to reproduce the issue

Start run.bat

Expected behaviour

Install?

Downloaded Build Of WSA

WSA_2311.40000.5.0_x64

Windows build number

22635.3350

PC Specification

(normal PC, obviously irrelevant)

Additional context

No response

Duplicate (I didn't notice at first)

#345

ChatGPT compared the lists and said that these files are missing

After comparing the two lists, the unique elements that are present in the first list but not in the second are:

MakePri.ps1
apex
pri
xml
At the same time, there are no elements in the second list that are missing in the first. This means that all files and directories from the second list are present in the first.​​

Commenting on it, it worked

$FileList = Get-Content -Path .\filelist.txt
if (((Test-Path -Path $FileList) -eq $false).Count) {
    Write-Error "`r`nSome files are missing in the folder.`r`nPlease try to build again.`r`n`r`nPress any key to exit"
   $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
    exit 1
}

Did you fix it?
It's the same problem for me.

Comment this

image

@Schefflin

@MustardChef @bropines
Oh, commenting it in "install.ps1", but if so, magisk is failed.

@MustardChef @bropines Oh, commenting it in "install.ps1", but if so, magisk is failed.

Try opening the console as an administrator, and type there after the changes have been made

powerShell.exe -ExecutionPolicy Bypass -File .\Install.ps1

still……

still……

Hmmm, can you record the startup process? It would be better if you replace the original script with this one. Record a video for me and I’ll try to understand what’s going on (don’t pay attention to the Russian letters, it’s easier for me to work this way)

#
# This file is part of MagiskOnWSALocal.
#
# MagiskOnWSALocal is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# MagiskOnWSALocal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with MagiskOnWSALocal.  If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2023 LSPosed Contributors
#

$Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA..."

function Finish {
    # Была удалена команда Clear-Host
    Start-Process "shell:AppsFolder\MicrosoftCorporationII.WindowsSubsystemForAndroid_8wekyb3d8bbwe!SettingsApp"
    Start-Sleep -Seconds 3 # Таймер на 3 секунды перед запуском Magisk
    Start-Process "wsa://com.topjohnwu.magisk"
    Start-Sleep -Seconds 3 # Таймер на 3 секунды перед запуском Google Play Store
    Start-Process "wsa://com.android.vending"
    Start-Sleep -Seconds 3 # Таймер на 3 секунды перед запуском Android Settings
    Start-Process "wsa://com.android.settings"

    Write-Output "All Done!`r`nPress any key to exit"
    $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
    exit 0
}

$pwsh = "powershell.exe"

# Проверка на запуск от имени администратора и запрос повышения прав, если необходимо
if ((New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -ne $true) {
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
    $Proc = Start-Process -PassThru -Verb RunAs $pwsh -Args "-ExecutionPolicy Bypass -Command Set-Location '$PSScriptRoot'; &'$PSCommandPath' EVAL"
    if ($null -ne $Proc) {
        $Proc.WaitForExit()
    }
    if ($null -eq $Proc -or $Proc.ExitCode -ne 0) {
        Write-Warning "`r`nFailed 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 $pwsh -NoNewWindow -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"

# Включение функции виртуальной машины, если не активирована
if ($(Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform').State -ne "Enabled") {
    Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName 'VirtualMachinePlatform'
    Write-Warning "`r`nNeed 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
    }
}

if ((Test-Path -Path 'uwp') -eq $true) {
    [xml]$Xml = Get-Content ".\AppxManifest.xml";
    $Name = $Xml.Package.Identity.Name;
    Write-Output "Installing $Name version: $($Xml.Package.Identity.Version)"
    $ProcessorArchitecture = $Xml.Package.Identity.ProcessorArchitecture;
    $Dependencies = $Xml.Package.Dependencies.PackageDependency;
    $Dependencies | ForEach-Object {
        $InstalledVersion = Get-AppxPackage -Name $_.Name  | ForEach-Object { if ($_.Architecture -eq  $ProcessorArchitecture) { $_ } } | Sort-Object -Property Version | Select-Object -ExpandProperty Version -Last 1
        if ( $InstalledVersion -lt $_.MinVersion ) {
            if ($env:WT_SESSION) {
                $env:WT_SESSION = $null
                Write-Output "`r`nDependency should be installed but Windows Terminal is in use. Restarting to conhost.exe"
                Start-Process conhost.exe -Args "powershell.exe -ExecutionPolicy Bypass -Command Set-Location '$PSScriptRoot'; &'$PSCommandPath'"
                exit 1
            }
            Write-Output "Dependency package $($_.Name) $ProcessorArchitecture required minimum version: $($_.MinVersion). Installing..."
            Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path "uwp\$($_.Name)_$ProcessorArchitecture.appx"
        } else {
            Write-Output "Dependency package $($_.Name) $ProcessorArchitecture current version: $InstalledVersion.`r`nNothing to do."
        }
    }
} else {
    Write-Warning "`r`nIgnored install WSA dependencies."
}

# Проверка и удаление уже установленной WSA, если требуется
$Installed = $null
$Installed = Get-AppxPackage -Name $Name

if (($null -ne $Installed) -and (-not ($Installed.IsDevelopmentMode))) {
    Write-Warning "`r`nThere is already one installed WSA.`r`nPlease uninstall it first.`r`n`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) {
        # Была удалена команда Clear-Host
        Remove-AppxPackage -Package $Installed.PackageFullName
    } else {
        exit 1
    }
}

# Завершение работы WSA перед установкой
if ($Installed) {
    Write-Output "`r`nShutting down WSA..."
    Start-Process WsaClient -Wait -Args "/shutdown"
}
Stop-Process -Name "WsaClient" -ErrorAction SilentlyContinue

# Установка MagiskOnWSA и ожидание завершения
Write-Output "`r`nInstalling MagiskOnWSA..."
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
if ($?) {
    Finish
} elseif ($null -ne $Installed) {
    Write-Error "`r`nFailed to update.`r`nPress any key to uninstall existing installation while preserving user data.`r`nTake in mind that this will remove the Android apps' icon from the start menu.`r`nIf you want to cancel, close this window now."
    $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
    # Была удалена команда Clear-Host
    Remove-AppxPackage -PreserveApplicationData -Package $Installed.PackageFullName
    Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
    if ($?) {
        Finish
    }
}

Issue should now be fixed.
Reopen if it is not fixed.
Thank you.