Fixed distro problem on run ps1
All checks were successful
release / build-base (push) Successful in 4m32s
release / build-digital-heavy (push) Successful in 21m25s
release / build-digital-ator (push) Successful in 21m38s
release / build-digital-icarus (push) Successful in 22m5s
release / build-analog-xk (push) Successful in 22m44s
release / build-analog-xm (push) Successful in 26m20s
release / build-heavy (push) Successful in 26m31s
release / build-analog-heavy (push) Successful in 26m46s
release / build-chipathon-tools (push) Successful in 20m5s
All checks were successful
release / build-base (push) Successful in 4m32s
release / build-digital-heavy (push) Successful in 21m25s
release / build-digital-ator (push) Successful in 21m38s
release / build-digital-icarus (push) Successful in 22m5s
release / build-analog-xk (push) Successful in 22m44s
release / build-analog-xm (push) Successful in 26m20s
release / build-heavy (push) Successful in 26m31s
release / build-analog-heavy (push) Successful in 26m46s
release / build-chipathon-tools (push) Successful in 20m5s
This commit is contained in:
parent
594b3b13c3
commit
ffd56db136
53
run.ps1
53
run.ps1
@ -22,11 +22,27 @@ $global:CONTAINER_NAME=$global:SELECTED_STACK
|
|||||||
$global:EXECMODE='desktop'
|
$global:EXECMODE='desktop'
|
||||||
$global:PDK="gf180mcuD"
|
$global:PDK="gf180mcuD"
|
||||||
$global:DIRECTORY=Get-Location | Foreach-Object { $_.Path }
|
$global:DIRECTORY=Get-Location | Foreach-Object { $_.Path }
|
||||||
|
$global:WSL_DISTRO="NO DISTRO"
|
||||||
|
|
||||||
$global:PARAMS = ""
|
$global:PARAMS = ""
|
||||||
|
|
||||||
New-Alias Call Invoke-Expression
|
New-Alias Call Invoke-Expression
|
||||||
|
|
||||||
|
function debug($fname, $message) {
|
||||||
|
Write-Host "[$fname] $message" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
function get-ubuntu-distro() {
|
||||||
|
# Identify if distro has (Predeterminado) or something like that
|
||||||
|
Invoke-Expression "wsl --list" | ForEach-Object {
|
||||||
|
if ($_ -match '\)' ) {
|
||||||
|
$global:WSL_DISTRO=$_.split('(')[0].replace(" ","")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debug "get-ubuntu-distro" "Linux distribution: $global:WSL_DISTRO"
|
||||||
|
}
|
||||||
|
|
||||||
function validate-environment() {
|
function validate-environment() {
|
||||||
Write-Host "Checking requirements and WSL updates" -ForegroundColor DarkGray
|
Write-Host "Checking requirements and WSL updates" -ForegroundColor DarkGray
|
||||||
|
|
||||||
@ -120,9 +136,34 @@ function path-conversion() {
|
|||||||
echo "/mnt/$($drive.tolower())$($path.replace("\","/"))"
|
echo "/mnt/$($drive.tolower())$($path.replace("\","/"))"
|
||||||
}
|
}
|
||||||
|
|
||||||
function get-value-from-wsl () {
|
function get-value-from-wsl() {
|
||||||
$variable, $other = $args
|
$variable, $other = $args
|
||||||
return "$(wsl -d Ubuntu bash -c "echo `$$variable")"
|
|
||||||
|
$cmd = "wsl bash -c `'echo `$$variable`'"
|
||||||
|
|
||||||
|
# Simple replacement
|
||||||
|
#$cmd = "wsl -d $global:WSL_DISTRO bash -c `'echo `$$variable`'"
|
||||||
|
#$cmd = "wsl -d `'$global:WSL_DISTRO`' bash -c `'echo `$$variable`'"
|
||||||
|
|
||||||
|
# Using parenthesis
|
||||||
|
#$cmd = "wsl -d $($global:WSL_DISTRO) bash -c `'echo `$$variable`'"
|
||||||
|
#$cmd = "wsl -d `'$($global:WSL_DISTRO)`' bash -c `'echo `$$variable`'"
|
||||||
|
#$cmd = "wsl -d `"$($global:WSL_DISTRO)`" bash -c `'echo `$$variable`'"
|
||||||
|
|
||||||
|
# Using curly braces
|
||||||
|
#$cmd = "wsl -d ${global:WSL_DISTRO} bash -c `'echo `$$variable`'"
|
||||||
|
#$cmd = "wsl -d '${global:WSL_DISTRO}' bash -c `'echo `$$variable`'"
|
||||||
|
|
||||||
|
# Using here strings (Never worked)
|
||||||
|
# @"
|
||||||
|
# "wsl -d $global:WSL_DISTRO bash -c `'echo `$$variable`'"
|
||||||
|
# "@
|
||||||
|
|
||||||
|
debug "get-value-from-wsl" "Command: $cmd"
|
||||||
|
|
||||||
|
$response = Invoke-Expression "$cmd"
|
||||||
|
debug "get-value-from-wsl" "Response: $response"
|
||||||
|
return $response
|
||||||
}
|
}
|
||||||
|
|
||||||
function set-common-parameters () {
|
function set-common-parameters () {
|
||||||
@ -160,7 +201,8 @@ function run-docker-wsl() {
|
|||||||
$global:PARAMS += " -v /mnt/wslg:/mnt/wsl"
|
$global:PARAMS += " -v /mnt/wslg:/mnt/wsl"
|
||||||
$global:PARAMS += " -v ${global:DIRECTORY}:/home/designer/shared "
|
$global:PARAMS += " -v ${global:DIRECTORY}:/home/designer/shared "
|
||||||
|
|
||||||
Call "wsl -d Ubuntu bash --noprofile --norc -ic `"docker run $global:PARAMS $global:IMAGE $global:COMMAND`""
|
#Call "wsl -d $global:WSL_DISTRO bash --noprofile --norc -ic `"docker run $global:PARAMS $global:IMAGE $global:COMMAND`""
|
||||||
|
Call "wsl bash --noprofile --norc -ic `"docker run $global:PARAMS $global:IMAGE $global:COMMAND`""
|
||||||
|
|
||||||
if ($?) {
|
if ($?) {
|
||||||
Write-Host "Container created successfully!" -ForegroundColor Green
|
Write-Host "Container created successfully!" -ForegroundColor Green
|
||||||
@ -173,9 +215,9 @@ function run-docker-wsl() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function run-docker-win() {
|
function run-docker-win() {
|
||||||
$global:PARAMS += " -v '\\wsl.localhost\Ubuntu\mnt\wslg:/tmp'"
|
$global:PARAMS += " -v '\\wsl.localhost\$global:WSL_DISTRO\mnt\wslg:/tmp'"
|
||||||
$global:PARAMS += " -v ${global:DIRECTORY}:/home/designer/shared"
|
$global:PARAMS += " -v ${global:DIRECTORY}:/home/designer/shared"
|
||||||
#$global:PARAMS += " -v '\\wsl.localhost\Ubuntu\mnt\wslg\runtime-dir'%XDG_RUNTIME_DIR%"
|
#$global:PARAMS += " -v '\\wsl.localhost\$global:WSL_DISTRO\mnt\wslg\runtime-dir'%XDG_RUNTIME_DIR%"
|
||||||
|
|
||||||
Call "docker run $global:PARAMS $global:IMAGE $global:COMMAND"
|
Call "docker run $global:PARAMS $global:IMAGE $global:COMMAND"
|
||||||
|
|
||||||
@ -214,6 +256,7 @@ function run(){
|
|||||||
|
|
||||||
download-run-bat
|
download-run-bat
|
||||||
validate-environment
|
validate-environment
|
||||||
|
get-ubuntu-distro
|
||||||
|
|
||||||
if ($interactive) {
|
if ($interactive) {
|
||||||
select-stack
|
select-stack
|
||||||
|
Loading…
Reference in New Issue
Block a user