File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33set -ex
4+
5+ #
6+ # Method to use docker CLI to determine if we're using docker or podman
7+ #
8+ # Sets container_engine global variable with either "docker" or "podman"
9+ #
10+ get_container_engine () {
11+ local DOCKER_VERSION_STRING=$( docker --version 2> /dev/null)
12+
13+ if [[ " $DOCKER_VERSION_STRING " == * " Docker" * ]]; then
14+ container_engine=" docker"
15+ elif [[ " $DOCKER_VERSION_STRING " == * " podman" * ]]; then
16+ container_engine=" podman"
17+ else
18+ echo " Unable to determine container engine using docker CLI"
19+ exit 1
20+ fi
21+ }
22+
423DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
524
25+ get_container_engine
26+
627WORKSPACE=$( pwd)
728YOSYS_EXE=${YOSYS_EXE:-/ OpenROAD-flow-scripts/ tools/ install/ yosys/ bin/ yosys}
829OPENROAD_EXE=${OPENROAD_EXE:-/ OpenROAD-flow-scripts/ tools/ install/ OpenROAD/ bin/ openroad}
@@ -17,9 +38,15 @@ if test -t 0; then
1738 DOCKER_INTERACTIVE=-ti
1839fi
1940
41+ if [[ $container_engine == " podman" ]]; then
42+ user_args=" --privileged --userns=keep-id"
43+ else
44+ user_args=" -u $( id -u ${USER} ) :$( id -g ${USER} ) "
45+ fi
46+
2047# Most of these options below has to do with allowing to
2148# run the OpenROAD GUI from within Docker.
22- docker run --privileged -u $( id -u ${USER} ) : $( id -g ${USER} ) \
49+ docker run $user_args \
2350 -e LIBGL_ALWAYS_SOFTWARE=1 \
2451 -e " QT_X11_NO_MITSHM=1" \
2552 -e XDG_RUNTIME_DIR=/tmp/xdg-run \
You can’t perform that action at this time.
0 commit comments