PortValhalla/scripts/Windows/Scripts/BashScript.ps1

16 lines
588 B
PowerShell

function Start-BashScript() {
param(
[Parameter(Mandatory=$true, Position=0)]
[string[]]$Content
)
Write-Information "Preparing setup script";
$bashLocation = Join-Path (Split-Path -Parent (Split-Path -Parent (Get-Command git-gui).Source)) "git-bash";
$script = New-TemporaryFile;
$script = Rename-Item $script -NewName "$script.sh" -PassThru;
Set-Content $script ([string]::Join("`n", $Content));
Write-Information "Running prepared script";
Start-Process -Wait "$bashLocation" -ArgumentList @("$script");
Remove-Item $script;
}