config/.zsh/host:mmaret-geny/function.zsh
2015-06-30 15:49:19 +02:00

21 lines
698 B
Bash

lollidocker (){
if [ -n "$SSH_AUTH_SOCK" ]; then
SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
fi
AOSP_ARGS=${AOSP_ARGS:--it}
img=$(docker ps | grep lollipop | awk '{print $1}');
if [ -z $img ]; then
img=$(docker ps -a | grep lollipop | awk '{print $1}') | head -1;
if [ -z $img ]; then
echo "Running a new container"
echo "docker run $AOSP_ARGS $SSH_AUTH_ARGS -v /home/mmaret/Project:/aosp/Project -i -t lollipop"
else
echo "Starting $img"
docker start -i -a $img
fi
else
echo "Attach to $img"
docker exec -it $img /bin/bash
fi
}