mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-10-12 06:44:59 +00:00
Trying to find the relevant yaml file was an issue as we now support `--name` and it might be in a different directory, so although it is a bit verbose outputing a whole file at least it is more consistent. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
40 lines
925 B
Bash
Executable File
40 lines
925 B
Bash
Executable File
#!/bin/sh
|
|
|
|
QEMU_IMAGE=mobylinux/qemu:75ef01c780850daf78ee45078606eb740a999edf@sha256:ec93951816b57d86f7a90c129a5580e083093e5a92263d0d2be6822daa2162dd
|
|
|
|
# if not interactive
|
|
if [ ! -t 0 -a -z "$1" ]
|
|
then
|
|
# non interactive, tarball input
|
|
docker run -i --rm "$QEMU_IMAGE"
|
|
exit $?
|
|
fi
|
|
|
|
FILE=$1
|
|
FILE2=$2
|
|
CMDLINE=$3
|
|
[ -z "$FILE" ] && FILE="$PWD/moby"
|
|
|
|
BASE=$(basename "$FILE")
|
|
DIR=$(dirname "$FILE")
|
|
if [ ! -f "$FILE" -a -f $DIR/$BASE-initrd.img -a -f $DIR/$BASE-bzImage ]
|
|
then
|
|
FILE=$DIR/$BASE-initrd.img
|
|
FILE2=$DIR/$BASE-bzImage
|
|
fi
|
|
|
|
echo "$FILE" | grep -q '^/' || FILE="$PWD/$FILE"
|
|
if [ ! -z "$FILE2" ]
|
|
then
|
|
echo "$FILE2" | grep -q '^/' || FILE2="$PWD/$FILE2"
|
|
fi
|
|
|
|
if [ -c "/dev/kvm" ] ; then
|
|
DEVKVM="--device=/dev/kvm"
|
|
fi
|
|
BASE=$(basename "$FILE")
|
|
MOUNTS="-v $FILE:/tmp/$BASE"
|
|
BASE2=$(basename "$FILE2")
|
|
[ ! -z "$FILE2" ] && MOUNTS="$MOUNTS -v $FILE2:/tmp/$BASE2"
|
|
docker run -it --rm $MOUNTS $DEVKVM "$QEMU_IMAGE" $CMDLINE
|