cleaned up podman/docker detection
This commit is contained in:
parent
65725888c7
commit
acdbb116fb
2 changed files with 24 additions and 27 deletions
19
dockergui
19
dockergui
|
@ -43,21 +43,15 @@ windowmanagerpid=$!
|
||||||
#detect podman or docker
|
#detect podman or docker
|
||||||
|
|
||||||
if command -v docker; then
|
if command -v docker; then
|
||||||
|
engine_of_choice="docker"
|
||||||
docker 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 \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
elif command -v podman; then
|
elif command -v podman; then
|
||||||
|
engine_of_choice="podman"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# then run the detected container engine
|
||||||
|
|
||||||
podman run --net=host \
|
$engine_of_choice run --net=host \
|
||||||
--rm \
|
--rm \
|
||||||
-e DISPLAY=:$DNum \
|
-e DISPLAY=:$DNum \
|
||||||
-v /tmp/.X11-unix/X$DNum:/tmp/.X11-unix/X$DNum:rw \
|
-v /tmp/.X11-unix/X$DNum:/tmp/.X11-unix/X$DNum:rw \
|
||||||
|
@ -67,9 +61,6 @@ elif command -v podman; then
|
||||||
--shm-size 2g \
|
--shm-size 2g \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
kill $windowmanagerpid
|
kill $windowmanagerpid
|
||||||
kill $xephyrpid
|
kill $xephyrpid
|
||||||
|
|
||||||
|
|
14
pkg-install
14
pkg-install
|
@ -45,9 +45,15 @@ RUN yay -S --noconfirm {package_name}
|
||||||
ENTRYPOINT [\"/usr/bin/env\", \"{command}\"]"
|
ENTRYPOINT [\"/usr/bin/env\", \"{command}\"]"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
# check if either docker or podman are installed
|
||||||
subprocess.run(["docker", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
|
||||||
|
|
||||||
except FileNotFoundError: # primitive way to detect that docker is not installed
|
docker_check = subprocess.call(["which", "docker"])
|
||||||
subprocess.run(["podman", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
|
||||||
|
if docker_check != 0:
|
||||||
|
print("Docker not installed, building with Podman")
|
||||||
|
engine = "podman"
|
||||||
|
else:
|
||||||
|
engine = "docker"
|
||||||
|
|
||||||
|
subprocess.run([engine, "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue