2014-11-11 23:49:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Simple AOSP wrapper to run commands in an AOSP docker container
|
|
|
|
#
|
|
|
|
# Author: Kyle Manna <kyle@kylemanna.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Override from environment
|
|
|
|
AOSP_IMAGE=${AOSP_IMAGE:-kylemanna/aosp}
|
|
|
|
AOSP_VOL=${AOSP_VOL:-/vol0}
|
|
|
|
AOSP_ARGS=${AOSP_ARGS:---rm -it}
|
2014-11-12 07:02:47 +01:00
|
|
|
AOSP_VOL_AOSP=${AOSP_VOL_AOSP:-$AOSP_VOL/aosp}
|
|
|
|
AOSP_VOL_CCACHE=${AOSP_VOL_CCACHE:-$AOSP_VOL/ccache}
|
2014-11-11 23:49:22 +01:00
|
|
|
|
2014-11-12 17:47:40 +01:00
|
|
|
if [ ! -d "$AOSP_VOL_AOSP" -o ! -d "$AOSP_VOL_CCACHE" ]; then
|
2014-11-12 07:02:47 +01:00
|
|
|
sudo mkdir -p $AOSP_VOL_AOSP $AOSP_VOL_CCACHE
|
|
|
|
sudo chmod 777 $AOSP_VOL_AOSP $AOSP_VOL_CCACHE
|
|
|
|
fi
|
2014-11-11 23:49:22 +01:00
|
|
|
|
2014-11-12 07:02:47 +01:00
|
|
|
if [ -n "$SSH_AUTH_SOCK" ]; then
|
|
|
|
SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
|
|
|
|
fi
|
2014-11-11 23:49:22 +01:00
|
|
|
|
2014-11-12 04:01:11 +01:00
|
|
|
docker run $AOSP_ARGS $SSH_AUTH_ARGS $AOSP_EXTRA_ARGS \
|
2014-11-12 07:02:47 +01:00
|
|
|
-v "$AOSP_VOL_AOSP:/aosp" -v "$AOSP_VOL_CCACHE:/tmp/ccache" \
|
2014-11-11 23:49:22 +01:00
|
|
|
$AOSP_IMAGE $@
|