zsh: sdocker more verbose

This commit is contained in:
Mathieu Maret 2022-07-12 14:27:20 +02:00
parent bc8a69ede5
commit 2dcb6bdcf7

View File

@ -285,16 +285,18 @@ sdocker (){
AOSP_ARGS=${AOSP_ARGS:--it}
img=$(docker ps | grep $1 | awk '{print $1}');
if [ -z $img ]; then
img=$(docker ps -a | grep -w $1 | awk '{print $1}' | head -1);
details=$(docker ps -a | grep -w $1 | head -1);
img=$(echo ${details} | awk '{print $1}')
img_name=$(echo ${details} | awk '{print $2}')
if [ -z $img ]; then
echo "Running a new container"
echo "Running a new container with image $img_name"
docker run ${AOSP_ARGS} ${=SSH_AUTH_ARGS} -h $(hostname) -e DISPLAY=${DISPLAY} --privileged -v /dev/bus/usb:/dev/bus/usb -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v ${AOSP_IMAGE}:/aosp/Project -v $HOME/Sources/:/aosp/Sources/ -v /local/:/local/ --user="$(id -u):$(id -g)" $1
else
echo "Starting $img"
echo "Starting $img|$img_name"
docker start -i -a $img
fi
else
echo "Attach to $img"
echo "Attach to $img|$img_name"
eval docker exec ${DOCKER_EXEC_ARGS} -it $img /bin/bash
fi
}