mirror of
https://github.com/LSPosed/MagiskOnWSALocal.git
synced 2025-04-25 17:59:35 +00:00
parent
ec58edfd47
commit
87ec298263
4 changed files with 49 additions and 29 deletions
|
@ -1,5 +1,5 @@
|
|||
# Automated Install script by Midonei
|
||||
$Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA..."
|
||||
$Host.UI.RawUI.WindowTitle = "Installing MagiskOnWSA...."
|
||||
function Test-Administrator {
|
||||
[OutputType([bool])]
|
||||
param()
|
||||
|
@ -49,7 +49,11 @@ If (((Test-Path -Path $FileList) -Eq $false).Count) {
|
|||
}
|
||||
|
||||
If ((Test-Path -Path "MakePri.ps1") -Eq $true) {
|
||||
Start-Process powershell.exe -Wait -Args "-ExecutionPolicy Bypass -File MakePri.ps1" -WorkingDirectory $PSScriptRoot
|
||||
$ProcMakePri = Start-Process powershell.exe -PassThru -Args "-ExecutionPolicy Bypass -File MakePri.ps1" -WorkingDirectory $PSScriptRoot
|
||||
$ProcMakePri.WaitForExit()
|
||||
If ($ProcMakePri.ExitCode -Ne 0) {
|
||||
Write-Warning "Failed to merge resources, WSA Seetings will always be in English`r`n"
|
||||
}
|
||||
}
|
||||
|
||||
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
|
||||
|
@ -101,7 +105,7 @@ If (($null -Ne $Installed) -And (-Not ($Installed.IsDevelopmentMode))) {
|
|||
}
|
||||
}
|
||||
Clear-Host
|
||||
Write-Host "Installing MagiskOnWSA..."
|
||||
Write-Host "Installing MagiskOnWSA...."
|
||||
Stop-Process -Name "WsaClient" -ErrorAction SilentlyContinue
|
||||
Add-AppxPackage -ForceApplicationShutdown -ForceUpdateFromAnyVersion -Register .\AppxManifest.xml
|
||||
If ($?) {
|
||||
|
|
|
@ -16,34 +16,49 @@
|
|||
# Copyright (C) 2023 LSPosed Contributors
|
||||
#
|
||||
|
||||
$Host.UI.RawUI.WindowTitle = "Merging resources...."
|
||||
If ((Test-Path -Path "pri") -Eq $true -And (Test-Path -Path "xml") -Eq $true) {
|
||||
$AppxManifestFile = ".\AppxManifest.xml"
|
||||
Copy-Item .\resources.pri -Destination ".\pri\resources.pri"
|
||||
$proc = Start-Process -PassThru makepri.exe -Args "new /pr .\pri /cf .\xml\priconfig.xml /of .\resources.pri /mn $AppxManifestFile /o"
|
||||
$proc.WaitForExit()
|
||||
If ($proc.ExitCode -Ne 0) {
|
||||
Write-Warning "Failed to merge resources`r`n"
|
||||
exit 1
|
||||
}
|
||||
else {
|
||||
$ProjectXml = [xml](Get-Content $AppxManifestFile)
|
||||
$ProjectResources = $ProjectXml.Package.Resources;
|
||||
$Item = Get-Item .\xml\* -Exclude "priconfig.xml" -Include "*.xml"
|
||||
$Item | ForEach-Object {
|
||||
$Xml = [xml](Get-Content $_)
|
||||
$Resource = $Xml.Package.Resources.Resource
|
||||
$newNode = $ProjectXml.ImportNode($Resource, $true)
|
||||
$ProjectResources.AppendChild($newNode)
|
||||
$ProcNew = Start-Process -PassThru makepri.exe -WindowStyle Hidden -Args "new /pr .\pri /cf .\xml\priconfig.xml /of .\resources.pri /mn $AppxManifestFile /o"
|
||||
$ProcNew.WaitForExit()
|
||||
If ($ProcNew.ExitCode -Ne 0) {
|
||||
Write-Warning "Failed to merge resources from pri`r`nTrying to dump...."
|
||||
New-Item -Path "." -Name "priinfo" -ItemType "directory"
|
||||
$Processes = ForEach ($Item in Get-Item ".\pri\*" -Include "*.pri") {
|
||||
$Name = $Item.Name
|
||||
Write-Host "Dumping $Name....`r`n"
|
||||
Start-Process -PassThru -WindowStyle Hidden makepri.exe -Args "dump /if $Item /o /es .\resources.pri /of .\priinfo\$Name.xml /dt detailed"
|
||||
}
|
||||
Write-Host "Dumping resources....`r`n"
|
||||
$Processes | Wait-Process
|
||||
Write-Host "Creating pri from dumps....`r`n"
|
||||
$ProcNewFromDump = Start-Process -PassThru -WindowStyle Hidden makepri.exe -Args "new /pr .\priinfo /cf .\xml\priconfig.xml /of .\resources.pri /mn $AppxManifestFile /o"
|
||||
$ProcNewFromDump.WaitForExit()
|
||||
Remove-Item 'priinfo' -Recurse
|
||||
If ($ProcNewFromDump.ExitCode -Ne 0) {
|
||||
Write-Warning "Failed to merge resources from dump`r`n"
|
||||
exit 1
|
||||
}
|
||||
$ProjectXml.Save($AppxManifestFile)
|
||||
Remove-Item 'pri' -Recurse
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern '^pri$' -NotMatch)
|
||||
Remove-Item 'xml' -Recurse
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern '^xml$' -NotMatch)
|
||||
Remove-Item 'makepri.exe'
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern 'makepri.exe' -NotMatch)
|
||||
Remove-Item $PSCommandPath -Force
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern 'MakePri.ps1' -NotMatch)
|
||||
exit 0
|
||||
}
|
||||
|
||||
$ProjectXml = [xml](Get-Content $AppxManifestFile)
|
||||
$ProjectResources = $ProjectXml.Package.Resources;
|
||||
$Item = Get-Item .\xml\* -Exclude "priconfig.xml" -Include "*.xml"
|
||||
$Item | ForEach-Object {
|
||||
$Xml = [xml](Get-Content $_)
|
||||
$Resource = $Xml.Package.Resources.Resource
|
||||
$newNode = $ProjectXml.ImportNode($Resource, $true)
|
||||
$ProjectResources.AppendChild($newNode)
|
||||
}
|
||||
$ProjectXml.Save($AppxManifestFile)
|
||||
Remove-Item 'pri' -Recurse
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern '^pri$' -NotMatch)
|
||||
Remove-Item 'xml' -Recurse
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern '^xml$' -NotMatch)
|
||||
Remove-Item 'makepri.exe'
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern 'makepri.exe' -NotMatch)
|
||||
Remove-Item $PSCommandPath -Force
|
||||
Set-Content -Path "filelist.txt" -Value (Get-Content -Path "filelist.txt" | Select-String -Pattern 'MakePri.ps1' -NotMatch)
|
||||
exit 0
|
||||
}
|
||||
|
|
|
@ -898,7 +898,7 @@ if [ "$COMPRESS_OUTPUT" ] || [ -n "$COMPRESS_FORMAT" ]; then
|
|||
elif [ "$COMPRESS_FORMAT" = "xz" ]; then
|
||||
echo "Compressing with tar xz"
|
||||
if ! (tar -cP -I 'xz -9 -T0' -f "$OUTPUT_PATH" "$WORK_DIR/wsa/$artifact_name"); then
|
||||
echo "Out of memory? Trying again with single threads..."
|
||||
echo "Out of memory? Trying again with single threads...."
|
||||
tar -cPJvf "$OUTPUT_PATH" "$WORK_DIR/wsa/$artifact_name" || abort
|
||||
fi
|
||||
elif [ "$COMPRESS_FORMAT" = "zip" ]; then
|
||||
|
|
|
@ -7,5 +7,6 @@
|
|||
<indexer-config type="folder" foldernameAsQualifier="true" filenameAsQualifier="true"
|
||||
qualifierDelimiter="." />
|
||||
<indexer-config type="PRI" />
|
||||
<indexer-config type="priinfo" />
|
||||
</index>
|
||||
</resources>
|
Loading…
Add table
Reference in a new issue