From 26d2363227f8d343ce7f7071b2bd754421971b1c Mon Sep 17 00:00:00 2001 From: Mario1159 Date: Wed, 6 Sep 2023 03:32:55 -0300 Subject: [PATCH] Cosmetic changes --- scripts/wsl_start.ps1 | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/scripts/wsl_start.ps1 b/scripts/wsl_start.ps1 index fc8ff26..2b5c496 100644 --- a/scripts/wsl_start.ps1 +++ b/scripts/wsl_start.ps1 @@ -1,7 +1,24 @@ param([switch] $remote = $false) -$imagename = Read-Host -Prompt 'Container image to initialize' -$containername = Read-Host -Prompt 'Container instance name [default=$imagename]' +Write-Host "OSIC-Stacks Container Creation" -ForegroundColor Green +Write-Host "Please select an image index:" + +$imageoptions = @( + 'analog-xk' + 'analog-xm' + 'digital-ator' + 'digital-icarus' + 'heavy' +) + +for($i = 0; $i -lt $imageoptions.Length; $i++) { + $imageoption = $imageoptions[$i] + Write-Host "$i - $imageoption" -ForegroundColor Cyan +} + +$imageindex = Read-Host -Prompt "Container image to initialize [0-$($imageoptions.Length)]" +$imagename = $imageoptions[$imageindex] +$containername = Read-Host -Prompt "Container instance name [default=$imagename]" if (!$containername) { $containername = $imagename } if($remote) { @@ -10,7 +27,9 @@ if($remote) { $image = $imagename } -$command = ("docker run -d " + +Write-Host "" + +$dockercommand = ("docker run -d " + "--name $containername " + "-v /tmp/.X11-unix:/tmp/.X11-unix " + "-v /mnt/wslg:/mnt/wsl " + @@ -19,4 +38,11 @@ $command = ("docker run -d " + "-e XDG_RUNTIME_DIR=/mnt/wslg " + $image) -wsl bash -ic $command \ No newline at end of file +wsl bash -ic $dockercommand + +if ($?) { + Write-Host "Container created successfully!" -ForegroundColor Green + Write-Host "Enter the container with `"docker exec -it $containername bash`"" -ForegroundColor DarkGray +} else { + Write-Host "Container creation failed, see logs above" -ForegroundColor Red +} \ No newline at end of file