From 25dc1d6597c82a6c368ed1ac00a250602c55f7e1 Mon Sep 17 00:00:00 2001 From: Howard Wu Date: Mon, 20 Mar 2023 01:41:43 +0800 Subject: [PATCH] Optimize VHD after install --- installer/Install.ps1 | 30 +++++++++++++++++++++++++++++- installer/Run.bat | 18 +++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/installer/Install.ps1 b/installer/Install.ps1 index 65c6b16..518a394 100644 --- a/installer/Install.ps1 +++ b/installer/Install.ps1 @@ -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 . +# +# 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" diff --git a/installer/Run.bat b/installer/Run.bat index 3f68708..5d9539d 100644 --- a/installer/Run.bat +++ b/installer/Run.bat @@ -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 . +:: +:: Copyright (C) 2023 LSPosed Contributors +:: @echo off if not exist Install.ps1 (