mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-11 08:56:05 +00:00
5eb5ff2bdf
Using 'docker run -it' works for interactive sessions but not inside the CI environment. We want both so make it optional by detecting if stdin is a terminal. Signed-off-by: David Sterba <dsterba@suse.com>
29 lines
672 B
Bash
Executable File
29 lines
672 B
Bash
Executable File
#!/bin/bash
|
|
# Run the container
|
|
# $0 [docker arguments] [-- command and arguments]
|
|
|
|
prefix=kdave
|
|
image=$(basename `pwd` | tr '[A-Z]' '[a-z]')
|
|
|
|
declare -a ARGS
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--) shift; break;;
|
|
*) ARGS+=("$1"); shift;;
|
|
esac
|
|
done
|
|
|
|
echo "ARGS: ${ARGS[@]}"
|
|
echo "RUN : $@"
|
|
|
|
# Running inside non-interactive terminal would fail
|
|
tty=
|
|
if [ -t 1 ]; then
|
|
tty=-it
|
|
fi
|
|
|
|
# Device mapper devices are not visible inside the environment if the /dev mount
|
|
# is the default one (tmpfs instead of devtmpfs)
|
|
# Mounts and loop device manipulation is required
|
|
docker run --mount type=bind,source=/dev,target=/dev $tty --privileged "${ARGS[@]}" "$prefix/$image" "$@"
|