Added WSLDISTRO variable, is not working in commands
This commit is contained in:
parent
9337a522bf
commit
584229fbf0
35
run.ps1
35
run.ps1
@ -22,11 +22,22 @@ $global:CONTAINER_NAME=$global:SELECTED_STACK
|
||||
$global:EXECMODE='desktop'
|
||||
$global:PDK="gf180mcuC"
|
||||
$global:DIRECTORY=Get-Location | Foreach-Object { $_.Path }
|
||||
$global:WSLDISTRO='Ubuntu'
|
||||
|
||||
$global:PARAMS = ""
|
||||
|
||||
New-Alias Call Invoke-Expression
|
||||
|
||||
function get-ubuntu-distro() {
|
||||
# Identify if distro has (Predeterminado) or something like that
|
||||
Invoke-Expression "wsl --list" | ForEach-Object {
|
||||
if ($_ -match '\)' ) {
|
||||
$global:WSLDISTRO = $_.split('(')[0].replace(" ","")
|
||||
Write-Host "Using distro: $global:WSLDISTRO"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validate-environment() {
|
||||
Write-Host "Checking requirements and WSL updates" -ForegroundColor DarkGray
|
||||
|
||||
@ -122,7 +133,8 @@ function path-conversion() {
|
||||
|
||||
function get-value-from-wsl () {
|
||||
$variable, $other = $args
|
||||
return "$(wsl -d Ubuntu bash -c "echo `$$variable")"
|
||||
$command = "wsl -d Ubuntu --exec bash --noprofile --norc -c 'echo `$$($variable)'"
|
||||
return "$(Invoke-Expression $command)"
|
||||
}
|
||||
|
||||
function set-common-parameters () {
|
||||
@ -143,9 +155,6 @@ function set-common-parameters () {
|
||||
$global:PARAMS += " --name $global:CONTAINER_NAME"
|
||||
$global:PARAMS += " --security-opt seccomp=unconfined"
|
||||
|
||||
# $global:PARAMS += " -p '8888:8888'"
|
||||
# $global:PARAMS += " -p '8082:8082'"
|
||||
|
||||
$global:PARAMS += " -e PDK=$global:PDK"
|
||||
|
||||
$global:PARAMS += " -e DISPLAY=$(get-value-from-wsl "DISPLAY")"
|
||||
@ -173,11 +182,15 @@ function run-docker-wsl() {
|
||||
}
|
||||
|
||||
function run-docker-win() {
|
||||
$global:PARAMS += " -v '\\wsl.localhost\Ubuntu\mnt\wslg:/tmp'"
|
||||
$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\Ubuntu\mnt\wslg:/tmp'" # WORKS
|
||||
#$global:PARAMS += " -v '\\wsl.localhost\$global:WSLDISTRO\mnt\wslg:/tmp'" # DON'T WORKS
|
||||
#$global:PARAMS += " -v '\\wsl.localhost\${global:WSLDISTRO}\mnt\wslg:/tmp'" # DON'T WORKS
|
||||
#$global:PARAMS += " -v '\\wsl.localhost\$(return $global:WSLDISTRO)\mnt\wslg:/tmp'" # DON'T WORKS
|
||||
#$global:PARAMS += " -v '\\wsl.localhost\" + $($global:WSLDISTRO) + "mnt\wslg:/tmp'" # DON'T WORKS
|
||||
|
||||
$global:PARAMS += " -v $global:DIRECTORY:/home/designer/shared"
|
||||
|
||||
Call "docker run $global:PARAMS $global:IMAGE $global:COMMAND"
|
||||
Call "docker run ${global:PARAMS} ${global:IMAGE} ${global:COMMAND}"
|
||||
|
||||
if ($?) {
|
||||
Write-Host "Container created successfully!" -ForegroundColor Green
|
||||
@ -200,20 +213,20 @@ function download-run-bat () {
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "run.bat updated successfully" -ForegroundColor Green
|
||||
Write-Host "run.ps1 updated successfully" -ForegroundColor Green
|
||||
}
|
||||
|
||||
function run(){
|
||||
if ($silent) {
|
||||
Write-Host "[Silent Mode]" -ForegroundColor Yellow
|
||||
Remove-Alias Call
|
||||
New-Alias Call Write-Host
|
||||
Set-Alias Call Write-Host
|
||||
}
|
||||
|
||||
Write-Host "OSIC-Stacks Container Creation" -ForegroundColor Green
|
||||
|
||||
download-run-bat
|
||||
validate-environment
|
||||
get-ubuntu-distro
|
||||
|
||||
if ($interactive) {
|
||||
select-stack
|
||||
|
Loading…
Reference in New Issue
Block a user