| 1 | #!/bin/sh |
| 2 | |
| 3 | if [ -z "${ANDROID_HOST_OUT}" ]; then |
| 4 | echo 'ANDROID_HOST_OUT not set. Have you run lunch?' |
| 5 | exit 1 |
| 6 | elif [ -z "${ANDROID_BUILD_TOP}" ]; then |
| 7 | echo 'ANDROID_BUILD_TOP not set. Have you run lunch?' |
| 8 | exit 1 |
| 9 | elif [ ! -f "$ANDROID_HOST_OUT/lib64/libselinux.so" ]; then |
| 10 | echo "Cannot find $ANDROID_HOST_OUT/lib64/libselinux.so" |
| 11 | echo "Need to build project" |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
| 15 | unamestr=`uname` |
| 16 | if [ "$unamestr" = "Linux" -o "$unamestr" = "linux" ]; then |
| 17 | export LD_PRELOAD=$ANDROID_HOST_OUT/lib64/libselinux.so |
| 18 | export PYTHONPATH=$ANDROID_BUILD_TOP/prebuilts/python/linux-x86/2.7.5/lib/python2.7/site-packages |
| 19 | exec python $ANDROID_BUILD_TOP/external/selinux/python/audit2allow/audit2why "$@" |
| 20 | else |
| 21 | echo "audit2why is only supported on linux" |
| 22 | exit 1 |
| 23 | fi |