Skip to content

Commit 7e1053d

Browse files
authored
Merge pull request #16 from VibhorCodecianGupta/sdk
Add: android-sdk install scripts
2 parents 6c11a05 + 09b9410 commit 7e1053d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS
4+
DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS
5+
APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions
6+
PACMAN_CMD=$(which pacman) # pacman package manager for ArchLinux
7+
APK_CMD=$(which apk) # apk package manager for Alpine
8+
9+
if [ ! -z $APT_GET_CMD ]; then
10+
sudo apt-get update
11+
sudo apt-get install android-sdk
12+
elif [ ! -z $APK_CMD ]; then
13+
sudo apk add --no-cache bash unzip libstdc++
14+
mkdir -p /opt/android-sdk && cd /opt/android-sdk
15+
&& wget -q http://dl.google.com/android/repository/tools_r27.0.0-linux.zip -O android-sdk-tools.zip
16+
&& unzip -q android-sdk-tools.zip -d /opt/android-sdk
17+
&& rm -f android-sdk-tools.zip
18+
&& chmod 755 /opt/android-sdk/
19+
&& echo y | android update sdk -a --no-ui --filter build-tools-25.0.2
20+
elif [ ! -z $PACMAN_CMD ]; then
21+
sudo pacman -S --needed base-devel git wget yajl
22+
cd /tmp && git clone https://aur.archlinux.org/package-query.git
23+
cd package-query/ && makepkg -si
24+
cd /tmp/ && git clone https://aur.archlinux.org/yaourt.git
25+
cd yaourt/ && makepkg si
26+
yaourt -S android-sdk android-sdk-platform-tools android-sdk-build-tools
27+
sudo touch /tmp/script.sh
28+
cat <<EOF > /tmp/script.sh
29+
export ANDROID_HOME=/opt/android-sdk
30+
export PATH=$PATH:$ANDROID_HOME/tools
31+
export PATH=$PATH:$ANDROID_HOME/platform-tools
32+
EOF
33+
source /tmp/script.sh
34+
sudo rm /tmp/script.sh
35+
else
36+
echo "Couldn't install package"
37+
exit 1;
38+
fi
39+
40+
android-sdk --version

0 commit comments

Comments
 (0)