-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall_android.sh
executable file
·50 lines (37 loc) · 1.87 KB
/
install_android.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# tested on ubuntu 16.04 (gnome)
# tested on ubuntu 14.04.3 (gnome)
SCRIPT_NAME=$(basename $BASH_SOURCE)
SCRIPT_LOGFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".log"
SCRIPT_ENVFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".env"
mkdir -p ./logs && chmod 755 ./logs
echo "running "$SCRIPT_NAME
if grep -Fxq "# installed by ubuntu-desktop-post-install/install_android.sh #" ~/.bashrc
then
echo " Android sdk, ndk, studio already installed"
else
sudo add-apt-repository -y ppa:ubuntu-desktop/ubuntu-make &>> $SCRIPT_LOGFILE
sudo apt-get -y update &>> $SCRIPT_LOGFILE
sudo apt-get -y install ubuntu-make &>> $SCRIPT_LOGFILE
yes 'a' | umake android android-ndk /home/$USER/tools/android/android-ndk
yes 'a' | umake android android-studio /home/$USER/tools/android/android-studio
echo '' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '# android sdk, nkd, studio' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo '# installed by ubuntu-desktop-post-install/install_android.sh #' >> ~/.bashrc
echo '#' >> ~/.bashrc
echo 'export PATH="$HOME/tools/android/android-ndk:$PATH"' >> ~/.bashrc
echo 'export PATH="$HOME/Android/Sdk/platform-tools:$PATH"' >> ~/.bashrc
echo 'export PATH="$HOME/Android/Sdk/tools:$PATH"' >> ~/.bashrc
echo 'export PATH="$HOME/Android/Sdk/build-tools:$PATH"' >> ~/.bashrc
echo '' >> ~/.bashrc
# update env file, so the parent shell can update its env too
echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> $SCRIPT_ENVFILE
echo 'export PATH="$HOME/tools/android/android-ndk:$PATH"' >> $SCRIPT_ENVFILE
echo 'export PATH="$HOME/Android/Sdk/platform-tools:$PATH"' >> $SCRIPT_ENVFILE
echo 'export PATH="$HOME/Android/Sdk/tools:$PATH"' >> $SCRIPT_ENVFILE
echo 'export PATH="$HOME/Android/Sdk/build-tools:$PATH"' >> $SCRIPT_ENVFILE
echo " !!! Please logout/relogin to be able to use Android SDK tools"
echo " !!! tip: type 'android' to access android sdk manager"
fi