Tuesday, September 01, 2009

Fixing Android NDK permissions

Lately Linux is being treated more as a kind of Windows-like than a UNIX-like operating system it really is.
It seems that everybody has forgotten it is a multiuser operating system and most likely you don't want to install a single copy of every software just because some permissions are wrongly set mainly due to be distributed as a ZIP file which doesn't store this information.

Fixing Android SDK permissions was described in Ooops!..., they did it again. Here, we are fixing Android NDK permissions for your multi-user development environment.

Android NDK is a companion tool to the Android SDK that lets Android application developers build performance-critical portions of their apps in native code.

Other problem you may find during installation in Debian and Ubuntu is that Android NDK installation script invokes /bin/sh expecting to be bash. If you use bash syntax you should invoke it using /bin/bash. This problem will be fixed in next release.

Use this script to fix all of the problems, after unzipping as root:

#! /bin/bash


NDK_DIR=${NDK_DIR:-/opt/android-ndk-1.5_r1}

sudo chmod a+rx $NDK_DIR
sudo find $NDK_DIR/ -type d -exec chmod a+rx {} \;
sudo find $NDK_DIR/ ! -perm -044 -exec chmod g+r,o+r {} \;
sudo find $NDK_DIR/ -type d -name bin -exec chmod -R a+x {} \;
[ ! -d $NDK_DIR/out/apps ] && sudo mkdir $NDK_DIR/out/apps
sudo chmod a+rwx $NDK_DIR/out/apps
( cd $NDK_DIR && sudo bash build/host-setup.sh )


Hope this helps.

No comments: