added primitive podman detection
This commit is contained in:
parent
835d190320
commit
65725888c7
2 changed files with 38 additions and 11 deletions
42
dockergui
42
dockergui
|
@ -26,7 +26,7 @@ xephyrpid=$!
|
||||||
if command -v ratpoison; then
|
if command -v ratpoison; then
|
||||||
sleep 1
|
sleep 1
|
||||||
ratpoison -d :$DNum &
|
ratpoison -d :$DNum &
|
||||||
else # Use the default x window manager installed based on the host
|
else # Use the default x window manager installed based on lsb_release id
|
||||||
DISPLAY=:$DNum
|
DISPLAY=:$DNum
|
||||||
distro_id=$(lsb_release -i | awk '{print($3)}')
|
distro_id=$(lsb_release -i | awk '{print($3)}')
|
||||||
|
|
||||||
|
@ -37,17 +37,39 @@ else # Use the default x window manager installed based on the host
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
windowmanagerpid=$!
|
windowmanagerpid=$!
|
||||||
|
|
||||||
docker run --net=host \
|
#detect podman or docker
|
||||||
--rm \
|
|
||||||
-e DISPLAY=:$DNum \
|
if command -v docker; then
|
||||||
-v /tmp/.X11-unix/X$DNum:/tmp/.X11-unix/X$DNum:rw \
|
|
||||||
--user $(id -u):$(id -g) \
|
docker run --net=host \
|
||||||
--group-add audio \
|
--rm \
|
||||||
--cap-drop=ALL \
|
-e DISPLAY=:$DNum \
|
||||||
--shm-size 2g \
|
-v /tmp/.X11-unix/X$DNum:/tmp/.X11-unix/X$DNum:rw \
|
||||||
"$@"
|
--user $(id -u):$(id -g) \
|
||||||
|
--group-add audio \
|
||||||
|
--cap-drop=ALL \
|
||||||
|
--shm-size 2g \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
elif command -v podman; then
|
||||||
|
|
||||||
|
|
||||||
|
podman run --net=host \
|
||||||
|
--rm \
|
||||||
|
-e DISPLAY=:$DNum \
|
||||||
|
-v /tmp/.X11-unix/X$DNum:/tmp/.X11-unix/X$DNum:rw \
|
||||||
|
--user $(id -u):$(id -g) \
|
||||||
|
--group-add audio \
|
||||||
|
--cap-drop=ALL \
|
||||||
|
--shm-size 2g \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
kill $windowmanagerpid
|
kill $windowmanagerpid
|
||||||
kill $xephyrpid
|
kill $xephyrpid
|
||||||
|
|
||||||
|
|
|
@ -45,4 +45,9 @@ RUN yay -S --noconfirm {package_name}
|
||||||
ENTRYPOINT [\"/usr/bin/env\", \"{command}\"]"
|
ENTRYPOINT [\"/usr/bin/env\", \"{command}\"]"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
subprocess.run(["docker", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
try:
|
||||||
|
subprocess.run(["docker", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
||||||
|
|
||||||
|
except FileNotFoundError: # primitive way to detect that docker is not installed
|
||||||
|
subprocess.run(["podman", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue