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
|
||||
|
||||
if command -v docker; then
|
||||
|
||||
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 \
|
||||
"$@"
|
||||
engine_of_choice="docker"
|
||||
|
||||
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 \
|
||||
-e DISPLAY=:$DNum \
|
||||
-v /tmp/.X11-unix/X$DNum:/tmp/.X11-unix/X$DNum:rw \
|
||||
|
@ -67,9 +61,6 @@ elif command -v podman; then
|
|||
--shm-size 2g \
|
||||
"$@"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
kill $windowmanagerpid
|
||||
kill $xephyrpid
|
||||
|
||||
|
|
14
pkg-install
14
pkg-install
|
@ -45,9 +45,15 @@ RUN yay -S --noconfirm {package_name}
|
|||
ENTRYPOINT [\"/usr/bin/env\", \"{command}\"]"
|
||||
"""
|
||||
|
||||
try:
|
||||
subprocess.run(["docker", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
||||
# check if either docker or podman are installed
|
||||
|
||||
except FileNotFoundError: # primitive way to detect that docker is not installed
|
||||
subprocess.run(["podman", "build", "-t", command, "-"], input = dockerfile, encoding = 'UTF-8')
|
||||
docker_check = subprocess.call(["which", "docker"])
|
||||
|
||||
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