|
|
@@ -60,6 +60,9 @@ param_args() {
|
|
|
|
arg "-v /run/user/$UID/bus:/tmp/bus"
|
|
|
|
arg "-v /run/user/$UID/bus:/tmp/bus"
|
|
|
|
arg "-e HOST_HOME=$HOME" # Used to translate paths.
|
|
|
|
arg "-e HOST_HOME=$HOME" # Used to translate paths.
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
-net) # Enable network dev-<container name>
|
|
|
|
|
|
|
|
arg "--network dev-$name"
|
|
|
|
|
|
|
|
;;
|
|
|
|
-x11) # Enable X11 support.
|
|
|
|
-x11) # Enable X11 support.
|
|
|
|
arg "-v /tmp/.X11-unix:/tmp/.X11-unix"
|
|
|
|
arg "-v /tmp/.X11-unix:/tmp/.X11-unix"
|
|
|
|
arg "-v $XAUTHORITY:/run/user/1000/.Xauthority:ro"
|
|
|
|
arg "-v $XAUTHORITY:/run/user/1000/.Xauthority:ro"
|
|
|
@@ -89,10 +92,6 @@ else
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
name="${image%:*}"
|
|
|
|
name="${image%:*}"
|
|
|
|
|
|
|
|
|
|
|
|
# check if ENV file is present, if so, source it
|
|
|
|
|
|
|
|
env_file="$(dirname "$(realpath "$0")")/containers/$name/env"
|
|
|
|
|
|
|
|
[ -f "$env_file" ] && source "${env_file}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get container registry from the DEVC_REGISTRY env
|
|
|
|
# Get container registry from the DEVC_REGISTRY env
|
|
|
|
# variable.
|
|
|
|
# variable.
|
|
|
|
if [ -n "${DEVC_REGISTRY:-}" ]; then
|
|
|
|
if [ -n "${DEVC_REGISTRY:-}" ]; then
|
|
|
@@ -112,6 +111,7 @@ fi
|
|
|
|
# recreate it.
|
|
|
|
# recreate it.
|
|
|
|
if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ] || [[ $# -gt 0 ]]; then
|
|
|
|
if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ] || [[ $# -gt 0 ]]; then
|
|
|
|
log "starting devcontainer..."
|
|
|
|
log "starting devcontainer..."
|
|
|
|
|
|
|
|
podman network create --ignore "dev-$name"
|
|
|
|
podman container rm -f -t 0 "$name" 1>/dev/null
|
|
|
|
podman container rm -f -t 0 "$name" 1>/dev/null
|
|
|
|
podman run -td $(default_args) $(param_args $@) "$registry/$image"
|
|
|
|
podman run -td $(default_args) $(param_args $@) "$registry/$image"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|