1#!/bin/sh 2 3if [ -z "${ANDROID_HOST_OUT}" ]; then 4 echo 'ANDROID_HOST_OUT not set. Have you run lunch?' 5 exit 1 6elif [ -z "${ANDROID_BUILD_TOP}" ]; then 7 echo 'ANDROID_BUILD_TOP not set. Have you run lunch?' 8 exit 1 9elif [ ! -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 13fi 14 15unamestr=`uname` 16if [ "$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 "$@" 20else 21 echo "audit2why is only supported on linux" 22 exit 1 23fi 24