Optimize VHD after install

This commit is contained in:
Howard Wu 2023-03-20 01:41:43 +08:00
parent 87ec298263
commit 25dc1d6597
2 changed files with 46 additions and 2 deletions

View file

@ -1,4 +1,21 @@
# Automated Install script by Midonei
# 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 Test-Administrator {
[OutputType([bool])]
@ -19,7 +36,18 @@ function Get-InstalledDependencyVersion {
}
}
Function Test-CommandExists {
Param ($command)
$oldPreference = $ErrorActionPreference
$ErrorActionPreference = 'stop'
try { if (Get-Command $command) { RETURN $true } }
Catch { Write-Host "$command does not exist"; RETURN $false }
Finally { $ErrorActionPreference = $oldPreference }
} #end function test-CommandExists
function Finish {
Write-Host "Optimizing VHDX size...."
If (Test-CommandExists Optimize-VHD) { Optimize-VHD ".\*.vhdx" -Mode Full }
Clear-Host
Start-Process "wsa://com.topjohnwu.magisk"
Start-Process "wsa://com.android.vending"

View file

@ -1,4 +1,20 @@
:: Automated Install batch script by Syuugo
:: 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
::
@echo off
if not exist Install.ps1 (