-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: android-sdk install scripts #16
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS | ||
DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS | ||
APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions | ||
PACMAN_CMD=$(which pacman) # pacman package manager for ArchLinux | ||
APK_CMD=$(which apk) # apk package manager for Alpine | ||
|
||
if [ ! -z $APT_GET_CMD ]; then | ||
sudo apt-get update | ||
sudo apt-get install android-sdk | ||
elif [ ! -z $APK_CMD ]; then | ||
sudo apk add --no-cache bash unzip libstdc++ | ||
mkdir -p /opt/android-sdk && cd /opt/android-sdk | ||
&& wget -q http://dl.google.com/android/repository/tools_r27.0.0-linux.zip -O android-sdk-tools.zip | ||
&& unzip -q android-sdk-tools.zip -d /opt/android-sdk | ||
&& rm -f android-sdk-tools.zip | ||
&& chmod 755 /opt/android-sdk/ | ||
&& echo y | android update sdk -a --no-ui --filter build-tools-25.0.2 | ||
elif [ ! -z $PACMAN_CMD ]; then | ||
sudo pacman -S --needed base-devel git wget yajl | ||
cd /tmp && git clone https://aur.archlinux.org/package-query.git | ||
cd package-query/ && makepkg -si | ||
cd /tmp/ && git clone https://aur.archlinux.org/yaourt.git | ||
cd yaourt/ && makepkg si | ||
yaourt -S android-sdk android-sdk-platform-tools android-sdk-build-tools | ||
sudo touch /tmp/script.sh | ||
cat <<EOF > /tmp/script.sh | ||
export ANDROID_HOME=/opt/android-sdk | ||
export PATH=$PATH:$ANDROID_HOME/tools | ||
export PATH=$PATH:$ANDROID_HOME/platform-tools | ||
EOF | ||
source /tmp/script.sh | ||
sudo rm /tmp/script.sh | ||
else | ||
echo "Couldn't install package" | ||
exit 1; | ||
fi | ||
|
||
android-sdk --version |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We exporting these here is not permanent, right? I think we should be adding these to a permanent place, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be permanent, I sourced the variable to the bash profile in the very next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how we set the environment variables for Java, maybe we can do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agentmilindu yes, I read about this. Linux requires direct changes to the environment file. However, that would mean logging in as sudo. We should run the entire script as sudo then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, We'll put the
sudo
command where necessary, the user will be prompted to enter the password then and there.