mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-26 21:24:15 +01:00
Update installation script
Make sure to run Powershell on the Administrator account using the console host Check the version before installing dependencies, and install dependencies only if needed
This commit is contained in:
parent
2f59f6d327
commit
97dba57d42
@ -294,8 +294,8 @@ RELEASE_NAME=${RELEASE_NAME_MAP[$RELEASE_TYPE]} || abort
|
||||
echo -e "Build: RELEASE_TYPE=$RELEASE_NAME"
|
||||
|
||||
WSA_ZIP_PATH=$DOWNLOAD_DIR/wsa-$ARCH-$RELEASE_TYPE.zip
|
||||
vclibs_PATH=$DOWNLOAD_DIR/vclibs-"$ARCH".appx
|
||||
xaml_PATH=$DOWNLOAD_DIR/xaml-"$ARCH".appx
|
||||
vclibs_PATH=$DOWNLOAD_DIR/Microsoft.VCLibs."$ARCH".14.00.Desktop.appx
|
||||
xaml_PATH=$DOWNLOAD_DIR/Microsoft.UI.Xaml_"$ARCH".appx
|
||||
MAGISK_PATH=$DOWNLOAD_DIR/magisk-$MAGISK_VER.zip
|
||||
if [ "$CUSTOM_MAGISK" ]; then
|
||||
if [ ! -f "$MAGISK_PATH" ]; then
|
||||
@ -685,13 +685,25 @@ function Test-Administrator {
|
||||
}
|
||||
}
|
||||
|
||||
function Test-WindowsTerminal { test-path env:WT_SESSION }
|
||||
|
||||
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)) {
|
||||
If (-Not (Test-Administrator) -Or (Test-WindowsTerminal)) {
|
||||
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()
|
||||
@ -703,7 +715,7 @@ If (-Not (Test-Administrator)) {
|
||||
exit
|
||||
}
|
||||
ElseIf ((\$args.Count -Eq 1) -And (\$args[0] -Eq "EVAL")) {
|
||||
Start-Process powershell.exe -Args "-ExecutionPolicy Bypass -Command Set-Location '\$PSScriptRoot'; &'\$PSCommandPath'"
|
||||
Start-Process ConHost.exe -Args "powershell -ExecutionPolicy Bypass -Command Set-Location '\$PSScriptRoot'; &'\$PSCommandPath'"
|
||||
exit
|
||||
}
|
||||
|
||||
@ -728,11 +740,27 @@ If (\$(Get-WindowsOptionalFeature -Online -FeatureName 'VirtualMachinePlatform')
|
||||
}
|
||||
}
|
||||
|
||||
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path vclibs-$ARCH.appx
|
||||
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Path xaml-$ARCH.appx
|
||||
[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 'MicrosoftCorporationII.WindowsSubsystemForAndroid'
|
||||
\$Installed = Get-AppxPackage -Name \$Name
|
||||
|
||||
If ((\$null -Ne \$Installed) -And (-Not (\$Installed.IsDevelopmentMode))) {
|
||||
Clear-Host
|
||||
|
@ -85,11 +85,11 @@ if not download_dir.is_dir():
|
||||
tmpdownlist = open(download_dir/tempScript, 'a')
|
||||
for i, v, f in identities:
|
||||
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", f):
|
||||
out_file_name = f"xaml-{arch}.appx"
|
||||
out_file_name = f"Microsoft.UI.Xaml_{arch}.appx"
|
||||
out_file = download_dir / out_file_name
|
||||
# elif re.match(f"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", f):
|
||||
# out_file = download_dir / "vclibs.appx"
|
||||
# out_file_name = "vclibs.appx"
|
||||
# out_file_name = f"Microsoft.VCLibs.140.00.UWPDesktop_{arch}.appx"
|
||||
# out_file = download_dir / out_file_name
|
||||
elif re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", f):
|
||||
out_file_name = f"wsa-{arch}-{release_type}.zip"
|
||||
out_file = download_dir / out_file_name
|
||||
@ -111,5 +111,4 @@ for i, v, f in identities:
|
||||
tmpdownlist.writelines(f' out={out_file_name}\n')
|
||||
tmpdownlist.writelines(f'https://aka.ms/Microsoft.VCLibs.{arch}.14.00.Desktop.appx\n')
|
||||
tmpdownlist.writelines(f' dir={download_dir}\n')
|
||||
tmpdownlist.writelines(f' out=vclibs-{arch}.appx\n')
|
||||
tmpdownlist.close()
|
||||
|
Loading…
Reference in New Issue
Block a user