[Android Software/Hacking General [Developers Only]] laufersteppenwolf:
Environment setup script

Who is bored of setting up an entire build environment for Android? I certainly am, which is why I wrote this "tiny" script :D

This script sets up a complete build environment, so you can directly start to repo sync a ROM after the script is done. And the best thing is, it is extremely customizable without even having to edit the script itself. All done by appending the appropriate flags to the executing command.

A further big advantage of this script is, that it is compatible with the two most common Linux distros Arch Linux and Ubuntu (also including all distros that are based on these 2, like Xubuntu, Lubuntu,....). This compatibility is achieved by detecting the distro in the beginning of the script and then using the appropriate commands (apt-get or pacman).

The script is located HERE and called "setup.sh"

To run the script, cd to the folder the script is located and enter ". setup.sh" and append all desired flags. If you need help, just append the "-h" or "--help" flag and some help will be shown.

So, you may ask yourself now "That's nice, but what the hell does this script install/set up?" and the answer is quite simple: All you need, and (if desired) even more :D

The "base package" includes:

Ccache

Java

GIT

All needed build tools

Python 2

The Android SDK

Furthermore, you can also choose the "extended package" by appending the flag "-e" or "--extended", which includes:

SSH

iostat

bmon

htop

geany

The dev-host commandline tool by GermainZ

udev-rules (on Arch only)

If this still isn't enough for you, you can also add your own packages. This can be done by either editing the script and entering the packages inside the quotes of the following line:

extra=""	# Add here some extra packages to install

OR

by appending the flag "-s" or "--special" and then listing the packages within quotes, seperated by spaces.

Example:

. setup.sh -s "package1 package2 package3"

This script is made to perform all actions on its own, however, it will not do so by default. To have it automated, you need to append either "-a" or "--automated". The script will then install the "base package" with all default packages (such as Oracle's JDK 6).

But you can still also append the other flags, like "-e", "-s", "-j",...

Now, let's talk about Java. This script can install 3 Java versions: Oracle's JDK 6, openJDK 6 and openJDK 7. The default version is Oracle's JDK 6. You can change the version by either appending the "-j" or "--java" flag followed by the desired version (1, 2 or 3), or if the -a flag isn't triggered, the script will ask you about it.

What? You don't want to install/change java at all? No problem! :D Just append "--no-java" and Java will get completely skipped.

The same thing also happens to the SDK when appending "--no-sdk".

The script has been tested on (X)ubuntu 13.10 and 14.04 by [MENTION=4216736]nilse[/MENTION] and me, and on Arch Linux by [MENTION=4248226]SMillerNL[/MENTION] and me. However, I have only tested Oracle's JDK 6, no other java versions but according to the wiki pages, it should work just fine ;)

You have suggestions, feedback, improvements? Shoot! Just let me know and I'll do my best to include it :)

A big thanks goes to my testers [MENTION=4216736]nilse[/MENTION] and [MENTION=4248226]SMillerNL[/MENTION] who also made some nice suggestions. But also to [MENTION=4775688]GermainZ[/MENTION] for his dev-host commandline tool

Furthermore to [MENTION=3544509]eagleeyetom[/MENTION] for giving me the idea ;)