improving ndk installer script

This commit is contained in:
Mariotaku Lee 2015-11-26 11:06:08 +08:00
parent 4548f523fc
commit 74870e59a0
1 changed files with 17 additions and 3 deletions

View File

@ -1,12 +1,18 @@
#!/bin/bash
project_dir=${OLDPWD}
local_opt_dir="${HOME}/.local/opt"
ndk_name="android-ndk-r10e"
ndk_install_dest="${local_opt_dir}/${ndk_name}"
if [ -d ${ndk_install_dest} ];
then exit
if [ -d ${ndk_install_dest} ]; then
echo "NDK already installed in ${ndk_install_dest}"
exit
fi
if [ ! -d ${local_opt_dir} ]; then
mkdir -p ${local_opt_dir}
fi
cd ${local_opt_dir}
@ -19,12 +25,20 @@ else
ndk_installer_name="${ndk_name}-linux-x86.bin"
fi
echo "Downloading NDK installer ${ndk_installer_name}"
wget "http://dl.google.com/android/ndk/${ndk_installer_name}"
chmod +x ${ndk_installer_name}
echo "Installing NDK installer ${ndk_installer_name}"
./${ndk_installer_name} -y 1>/dev/null
echo "Removing installed NDK installer ${ndk_installer_name}"
rm ${ndk_installer_name}
echo "ndk.dir=${ndk_install_dest}" >> ./local.properties
echo "Adding NDK install path to ${project_dir}"
echo "ndk.dir=${ndk_install_dest}" >> ${project_dir}/local.properties