53e8b80ed3
This patch add a way to choose container engine inside tool and test scripts. This is in preparation for Podman introduction but still leaves Docker as default container engine. Signed-off-by: Martin Hiner <m.hiner@partner.samsung.com> Change-Id: I395d2bdb0dfb4b325b6ad197c8893c8a0f768324
16 lines
500 B
Bash
Executable File
16 lines
500 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# This script can be used to check user privilege to execute
|
|
# docker or podman commands depending on CONTAINER_ENGINE
|
|
# environment variable
|
|
|
|
function check_dockerexecute {
|
|
sudo $CONTAINER_ENGINE ps &>/dev/null
|
|
return_val=$?
|
|
if [ $return_val -ne 0 ]; then
|
|
echo "User $USER can't seem to run ${CONTAINER_ENGINE^} commands. Verify product documentation to allow user to execute ${CONTAINER_ENGINE^} commands" 1>&2
|
|
exit 1
|
|
fi
|
|
}
|
|
check_dockerexecute
|