Skip to content

Instantly share code, notes, and snippets.

@tahl
Created April 13, 2012 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tahl/2375123 to your computer and use it in GitHub Desktop.
Save tahl/2375123 to your computer and use it in GitHub Desktop.
andadb2.2 for Ubuntu and Arch Linux
#!/bin/bash
#
#Android ADB Installer 2.1 for Ubuntu 11.10 and Arch Linux.
#Version 2.2 adds multi-distro support for Arch Linux. Ability to compile AOKP from source.
#Script written by @ArchDukeDoug and parts of @_CorCor67's scripting code used with permission as well.
#ADB Push script adapted to work from MappaM and pietro_spina's code on the xda-developer's forums.
#Thanks to @BoneyNicole, @tabbwabb, and @animedbz16 for putting up with me and proofreading and/or testing the script.
#Script version: 2.2
OS=`lsb_release -i | grep Distribu | awk {'print $3}'`
menu=
until [ "$menu" = "0" ]; do
clear
echo ""
echo "***************************************************"
echo "** Android ADB Installer 2.1 **"
echo "** Main Menu **"
echo "***************************************************"
echo "** 1 - Resolve dependencies ( Run this first )**"
echo "** 2 - Install Android SDK & Android NDK **"
echo "** 3 - Install adb & fastboot **"
echo "** 4 - Nautilus right-click to adb push support **"
echo "** 5 - MTP Support for Galaxy Nexus **"
echo "** 6 - Create/update the 99-android.rules file **"
echo "** 7 - Install aapt & apktool **"
echo "** 8 - Install git-repo **"
echo "** 9 - Compile AOKP build from source. **"
echo "** 10 - Help and information **"
echo "** 0 - Exit **"
echo "***************************************************"
echo ""
echo -n "Enter selection: "
read menu
echo ""
case $menu in
#############################################################
#############################################################
1 )
if [ "$OS" = "Ubuntu" ]; then
if [ ! -f /var/lib/apt/lists/archive.canonical.com_dists_oneiric_partner_binary-i386_Packages ]
then sudo -v; sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -s -c) partner"
else echo "repository already exists."
fi
sudo -v; sudo apt-get update
#Determine if the operating system is 32 or 64-bit and then install ia32-libs if necessary.
d=ia32-libs
if [[ `getconf LONG_BIT` = "64" ]];
then
echo "64-bit operating system detected. Checking to see if $d is installed."
if [[ $(dpkg-query -f'${Status}' --show $d 2>/dev/null) = *\ installed ]]; then
echo "$d already installed."
else
echo "Installing now..."
sudo -v; sudo apt-get --force-yes -y install $d
fi
else
echo "32-bit operating system detected. Skipping."
fi
#Check if openjdk-7-jre-headless is installed
c=openjdk-7-jre-headless
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if openjdk-7-jre is installed
c=openjdk-7-jdk
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if Eclipse is installed
c=eclipse
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if Python is installed
c=python
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if git-core is installed
c=git-core
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if gnupupg is installed
c=gnupg
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if flex is installed
c=flex
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if bison is installed
c=bison
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if gperf is installed
c=gperf
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if build-essential is installed
c=build-essential
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if zip is installed
c=zip
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if curl is installed
c=curl
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if zlib1g-dev is installed
c=zlib1g-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libc6-dev is installed
c=libc6-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if lib32ncurses5-dev is installed
c=lib32ncurses5-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if x11proto-core-dev is installed
c=x11proto-core-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libx11-dev is installed
c=libx11-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if lib32readline5-dev is installed
c=lib32readline5-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if lib32z-dev is installed
c=lib32z-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libgl1-mesa is installed
c=libgl1-mesa-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if g++-multilib is installed
c=g++-multilib
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if mingw32 is installed
c=mingw32
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if tofrodos is installed
c=tofrodos
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if python-markdown is installed
c=python-markdown
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libxml2-utils is installed
c=libxml2-utils
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check for ~/bin
if [ ! -d ~/bin ]
then
mkdir ~/bin
else
echo "~/bin already exists. Skipping."
fi
#Set ~/bin to path
if grep -q /home/$USER/bin /home/$USER/.bashrc;
then
echo "$HOME/bin set up already."
else
echo "PATH=$PATH:$HOME/bin" >> $HOME/.bashrc
fi
#Create a symlink for libX11
if [ -f "/usr/lib/i386-linux-gnu/libX11.so" ]
then
sudo -v; sudo rm /usr/lib/i386-linux-gnu/libX11.so; sudo -v; sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
else
sudo -v; sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
fi
fi
if [ "$OS" = "archlinux" ]; then
sudo pacman -Syy
#Check if Wget is installed
x=`pacman -Qs wget`
c=wget
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Uninstall openjdk7 - AOKP Compile errors
x=`pacman -Qs openjdk-7-jre-headless`
c=openjdk-7-jre-headless
if [ -n "$x" ]
then echo "$c is installed. Uninstalling."
sudo pacman -Rdd --noconfirm $c
else
echo "$c was not found, skipping..." 2>&1
fi
#Uninstall openjdk7 - AOKP Compile errors
x=`pacman -Qs jdk7-openjdk`
c=jdk7-openjdk
if [ -n "$x" ]
then echo "$c is installed. Uninstalling."
sudo pacman -Rdd --noconfirm $c
else
echo "$c was not found, skipping..." 2>&1
fi
#Install openjdk6 to get AOKP to compile
x=`pacman -Qs openjdk6`
c=openjdk6
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
#Check if Eclipse is installed
x=`pacman -Qs eclipse`
c=eclipse
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs python2`
c=python2
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs git`
c=git
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs gnupg`
c=gnupg
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs flex`
c=flex
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs bison`
c=bison
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs gperf`
c=gperf
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs base-devel`
c=base-devel
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs zip`
c=zip
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs curl`
c=curl
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs zlib`
c=zlib
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs glibc`
c=glibc
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs ncurses`
c=ncurses
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs xproto`
c=xproto
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-readline`
c=lib32-readline
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-libx11`
c=lib32-libx11
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-zlib`
c=lib32-zlib
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-mesa`
c=lib32-mesa
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-gcc-libs`
c=lib32-gcc-libs
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs mingw32-gcc`
c=mingw32-gcc
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs tofrodos`
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
wget http://aur.archlinux.org/packages/to/tofrodos/tofrodos.tar.gz; tar xvzf tofrodos.tar.gz; cd tofrodos; wget http://aur.archlinux.org/packages/to/tofrodos/PKGBUILD; makepkg -f; sudo -v; ls *.tar.xz |xargs sudo pacman --noconfirm -U; cd ..; rm tofrodos.tar.gz; rm -rf tofrodos
fi
x=`pacman -Qs python-markdown`
c=mingw32-gcc
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs libxml2`
c=libxml2
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if alsa-lib is installed
x=`pacman -Qs alsa-lib`
c=alsa-lib
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if java-runtime is installed
x=`pacman -Qs java-runtime`
c=java-runtime
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if libstdc++5 is installed
x=`pacman -Qs libstdc++5`
c=libstdc++5
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if libxv is installed
x=`pacman -Qs libxv`
c=libxv
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if ncurses is installed
x=`pacman -Qs ncurses`
c=ncurses
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if openal is installed
x=`pacman -Qs openal`
c=openal
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if sdl is installed
x=`pacman -Qs sdl`
c=sdl
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if swt is installed
x=`pacman -Qs swt`
c=swt
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if zlib is installed
x=`pacman -Qs zlib`
c=zlib
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
#Check if libmtp is installed
x=`pacman -Qs libmtp`
c=libmtp
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo pacman -S --noconfirm $c
fi
fi
;;
#############################################################
#############################################################
2 )
#Download and install the Android SDK
if [ ! -d "/usr/local/android-sdk" ]; then
for a in $( wget -qO- http://developer.android.com/sdk/index.html | egrep -o "http://dl.google.com[^\"']*linux.tgz" ); do
wget $a && tar --wildcards --no-anchored -xvzf android-sdk_*-linux.tgz; sudo -v; sudo mv android-sdk-linux /usr/local/android-sdk; sudo -v; sudo chmod 777 -R /usr/local/android-sdk; rm android-sdk_*-linux.tgz;
done
else
echo "Android SDK already installed to /usr/local/android-sdk. Skipping."
fi
#Create Symlink for Dalvik Debug Monitor Server (DDMS)
if [ -f /bin/ddms ]
then
sudo -v; sudo rm /bin/ddms; sudo -v; sudo ln -s /usr/local/android-sdk/tools/ddms /bin/ddms
else
sudo -v; sudo ln -s /usr/local/android-sdk/tools/ddms /bin/ddms
fi
#Download and install the Android NDK.
if [ ! -d "/usr/local/android-ndk" ]; then
for b in $( wget -qO- http://developer.android.com/sdk/ndk/index.html | egrep -o "http://dl.google.com[^\"']*linux-x86.tar.bz2"
); do wget $b && tar --wildcards --no-anchored -xjvf android-ndk-*-linux-x86.tar.bz2; sudo -v; sudo mv android-ndk-*/ /usr/local/android-ndk; sudo -v; sudo chmod 777 -R /usr/local/android-ndk; rm android-ndk-*-linux-x86.tar.bz2;
done
else
echo "Android NDK already installed to /usr/local/android-ndk. Skipping."
fi
;;
#############################################################
#############################################################
3 )
#Create a symlink for Android Debug Bridge (adb)
if [ -f /bin/adb ];
then
sudo -v; sudo rm /bin/adb; sudo -v; sudo ln -s /usr/local/android-sdk/platform-tools/adb /bin/adb
else
sudo -v; sudo ln -s /usr/local/android-sdk/platform-tools/adb /bin/adb
fi
#Create a symlink for Fastboot
if [ -f /bin/fastboot ];
then
sudo -v; sudo rm /bin/fastboot; sudo -v; sudo ln -s /usr/local/android-sdk/platform-tools/fastboot /bin/fastboot
else
sudo -v; sudo ln -s /usr/local/android-sdk/platform-tools/fastboot /bin/fastboot
fi
#Installing adb!
if [ ! -f "/usr/local/android-sdk/platform-tools/adb" ];
then
mkdir $HOME/.android; touch $HOME/.android/androidtool.cfg; echo "sdkman.force.http=true" > $HOME/.android/androidtool.cfg; nohup /usr/local/android-sdk/tools/android update sdk > /dev/null 2>&1
else
echo "Android Debug Bridge already detected."
fi
;;
#############################################################
#############################################################
4 )
#ADB Install APK
nautilus="adb install APKs" #name of right click command
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Installing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb install "${thing}"' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i APKs installed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Installing files..." --title "Installing APKs"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Installing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb install "${thing}"' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i APKs installed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Installing files..." --title "Installing APKs"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
#ADB Push to Downloads
nautilus="adb push to Download" #name of right click command
adbpath="/sdcard/Download" # path on phone to push to
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb push "${thing}" $adbpath' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
#ADB Push to SDCard
nautilus="adb push to SDCard" #name of right click command
adbpath="/sdcard/" # path on phone to push to
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb push "${thing}" $adbpath' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
#ADB Push to Movies
nautilus="adb push to Movies" #name of right click command
adbpath="/sdcard/Movies" # path on phone to push to
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb push "${thing}" $adbpath' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
#ADB Push to Music
nautilus="adb push to Music" #name of right click command
adbpath="/sdcard/Music" # path on phone to push to
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb push "${thing}" $adbpath' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
#ADB Push to Pictures
nautilus="adb push to Pictures" #name of right click command
adbpath="/sdcard/Pictures" # path on phone to push to
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo "adbpath=\"$adbpath\"" >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t echo "15" ; sleep 1' >> "$nautilus";
echo -e '\t echo $(($i * 100 / $#))' >>"$nautilus";
echo -e '\t echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo -e '\t adb push "${thing}" $adbpath' >>"$nautilus";
echo -e "\t i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
#ADB Push To...
nautilus="adb push to ..." #name of right click command
if [ ! -f "/home/$USER/.gnome2/nautilus-scripts/$nautilus" ];
then
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo 'adbpath=`zenity --entry --text "Enter the directory on the Android device" --entry-text="/sdcard/"`' >> "$nautilus";
echo "" >> "$nautilus";
echo 'for i in "" "/"' >> "$nautilus";
echo 'do' >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t if [ "$i" = "$adbpath" ]' >> "$nautilus";
echo -e '\t then' >> "$nautilus";
echo -e '\t\t zenity --error --text "You have to copy the files somewhere..."' >> "$nautilus";
echo -e 'fi' >> "$nautilus";
echo 'done' >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
else
touch "$nautilus"; chmod +x "$nautilus"; echo "#!/bin/sh" > "$nautilus";
echo 'adbpath=`zenity --entry --text "Enter the directory on the Android device" --entry-text="/sdcard/"`' >> "$nautilus";
echo "" >> "$nautilus";
echo 'for i in "" "/"' >> "$nautilus";
echo 'do' >> "$nautilus";
echo "" >> "$nautilus";
echo -e '\t if [ "$i" = "$adbpath" ]' >> "$nautilus";
echo -e '\t then' >> "$nautilus";
echo -e '\t\t zenity --error --text "You have to copy the files somewhere..."' >> "$nautilus";
echo -e 'fi' >> "$nautilus";
echo 'done' >> "$nautilus";
echo "" >> "$nautilus"; echo "i=1" >> "$nautilus"; echo "(" >> "$nautilus";
echo "for thing in \"\$@\"" >> "$nautilus";
echo "do" >> "$nautilus";
echo "" >> "$nautilus";
echo 'echo "15" ; sleep 1' >>"$nautilus";
echo 'echo $(($i * 100 / $#))' >>"$nautilus";
echo 'echo "# Pushing \"${thing}\"" ;' >>"$nautilus";
echo 'adb push "${thing}" $adbpath' >>"$nautilus";
echo "i=\$((\$i+1))" >>"$nautilus";
echo 'done; i=$(($i-1)) ; echo"# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $adbpath"' >>"$nautilus";
mv "$nautilus" /home/$USER/.gnome2/nautilus-scripts/
fi
;;
#############################################################
#############################################################
5 )
if [ "$OS" = "Ubuntu" ]; then
#Check if mtpfs is installed
c=mtpfs
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if fuse is installed, generate new Fuse file
c=fuse
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."; sudo mv /etc/fuse.conf /etc/fuse.conf.backup; touch fuse.conf; echo "# Set the maximum number of FUSE mounts allowed to non-root users." >> fuse.conf; echo "# The default is 1000." >> fuse.conf; echo "#" >> fuse.conf; echo "#mount_max = 1000" >> fuse.conf; echo "" >> fuse.conf; echo "# Allow non-root users to specify the 'allow_other' or 'allow_root'" >> fuse.conf; echo "# mount options." >> fuse.conf; echo "#" >> fuse.conf; echo "user_allow_other" >> fuse.conf; sudo mv fuse.conf /etc/fuse.conf; sudo adduser $USER fuse
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null; sudo mv /etc/fuse.conf /etc/fuse.conf.backup; touch fuse.conf; echo "# Set the maximum number of FUSE mounts allowed to non-root users." >> fuse.conf; echo "# The default is 1000." >> fuse.conf; echo "#" >> fuse.conf; echo "#mount_max = 1000" >> fuse.conf; echo "" >> fuse.conf; echo "# Allow non-root users to specify the 'allow_other' or 'allow_root'" >> fuse.conf; echo "# mount options." >> fuse.conf; echo "#" >> fuse.conf; echo "user_allow_other" >> fuse.conf; sudo mv fuse.conf /etc/fuse.conf; sudo adduser $USER fuse
fi
fi
if [ "$OS" = "archlinux" ]; then
x=`pacman -Qs mtpfs`
c=mtpfs
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs fuse`
c=fuse
if [ -n "$x" ]
then echo "$c already installed. Skipping."; sudo mv /etc/fuse.conf /etc/fuse.conf.backup; touch fuse.conf; echo "# Set the maximum number of FUSE mounts allowed to non-root users." >> fuse.conf; echo "# The default is 1000." >> fuse.conf; echo "#" >> fuse.conf; echo "#mount_max = 1000" >> fuse.conf; echo "" >> fuse.conf; echo "# Allow non-root users to specify the 'allow_other' or 'allow_root'" >> fuse.conf; echo "# mount options." >> fuse.conf; echo "#" >> fuse.conf; echo "user_allow_other" >> fuse.conf; sudo mv fuse.conf /etc/fuse.conf; sudo adduser $USER fuse
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c; sudo mv /etc/fuse.conf /etc/fuse.conf.backup; touch fuse.conf; echo "# Set the maximum number of FUSE mounts allowed to non-root users." >> fuse.conf; echo "# The default is 1000." >> fuse.conf; echo "#" >> fuse.conf; echo "#mount_max = 1000" >> fuse.conf; echo "" >> fuse.conf; echo "# Allow non-root users to specify the 'allow_other' or 'allow_root'" >> fuse.conf; echo "# mount options." >> fuse.conf; echo "#" >> fuse.conf; echo "user_allow_other" >> fuse.conf; sudo mv fuse.conf /etc/fuse.conf; sudo adduser $USER fuse
fi
fi
if [ ! -d "/media/GalaxyNexus" ];
then
sudo mkdir /media/GalaxyNexus; sudo chmod 775 /media/GalaxyNexus
else
echo "GalaxyNexus folder already exists"
fi
if [ -f "/etc/udev/rules.d/51-android.rules" ];
then
echo "Creating a backup of your 51-android.rules"; sudo mv /etc/udev/rules.d/51-android.rules /etc/udev/rules.d/51-android.rules.backup; touch 51-android.rules; echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"04e8\", ATTRS{idProduct}==\"6860\", MODE=\"777\", OWNER=\"$USER\" #Galaxy Nexus" > 51-android.rules; sudo mv 51-android.rules /etc/udev/rules.d/51-android.rules; sudo chmod a+r /etc/udev/rules.d/51-android.rules
else
touch 51-android.rules; echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"04e8\", ATTRS{idProduct}==\"6860\", MODE=\"777\", OWNER=\"$USER\" #Galaxy Nexus" > 51-android.rules; sudo mv 51-android.rules /etc/udev/rules.d/51-android.rules; sudo chmod a+r /etc/udev/rules.d/51-android.rules
fi
#Set android-connect to path
if grep -q android-connect /home/$USER/.bashrc;
then
echo "android-connect already set up."
else
echo "" >> ~/.bashrc; echo "alias android-connect=\"mkdir /home/$USER/GalaxyNexus && chmod 777 /home/$USER/GalaxyNexus && mtpfs -o allow_other /home/$USER/GalaxyNexus\"" >> ~/.bashrc
fi
#Set android-disconnect to path
if grep -q android-disconnect /home/$USER/.bashrc;
then
echo "android-connect already set up."
else
echo "" >> ~/.bashrc; echo "alias android-disconnect=\"fusermount -u /home/$USER/GalaxyNexus && rmdir /home/$USER/GalaxyNexus\"" >> ~/.bashrc
fi
;;
#############################################################
#############################################################
6 )
#Downloads the latest version of 99-android.rules
wget http://dl.dropbox.com/u/4413349/scripts/99-android.rules
sudo -v; sudo mv -f 99-android.rules /etc/udev/rules.d/
;;
#############################################################
#############################################################
7 )
#Download and install apktool-install.
if [ ! -f /usr/local/bin/aapt ]; then
wget http://android-apktool.googlecode.com/files/apktool-install-linux-r04-brut1.tar.bz2 && tar --wildcards --no-anchored -xjvf apktool-install-linux-r04-brut1.tar.bz2; sudo -v; sudo mv aapt /usr/local/bin/; sudo -v; sudo mv apktool /usr/local/bin/; sudo -v; sudo chmod 777 /usr/local/bin/aapt; sudo -v; sudo chmod 777 /usr/local/bin/apktool; rm apktool-install-linux-r04-brut1.tar.bz2; rm -rf apktool-install-linux-r04-brut1/;
else
echo "apktool-install already installed to /usr/local/bin. Skipping."
fi
#Download and install apktool.
if [ ! -f "/usr/local/bin/apktool.jar" ]; then
wget http://android-apktool.googlecode.com/files/apktool1.4.3.tar.bz2 && tar --wildcards --no-anchored -xjvf apktool1.4.3.tar.bz2; sudo -v; sudo mv apktool.jar /usr/local/bin/; sudo -v; sudo chmod 777 /usr/local/bin/apktool.jar; rm apktool1.4.3.tar.bz2; rm -rf apktool1.4.3/;
else
echo "apktool already installed to /usr/local/bin. Skipping."
fi
;;
#############################################################
#############################################################
8 )
#Check for ~/bin
if [ ! -d ~/bin ]
then
mkdir ~/bin
else
echo "~/bin already exists. Skipping."
fi
#Set ~/bin to path
if grep -q /home/$USER/bin /home/$USER/.bashrc;
then
echo "$HOME/bin set up already."
else
echo "PATH=$PATH:$HOME/bin" >> $HOME/.bashrc
fi
#Check for repo
if [ ! -f $HOME/bin/repo ];
then
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > $HOME/bin/repo; sudo chmod a+x $HOME/bin/repo
else
echo "$HOME/bin/repo already exists."
fi
;;
#############################################################
#############################################################
9 )
if [ "$OS" = "Ubuntu" ]; then
if [ ! -f /var/lib/apt/lists/archive.canonical.com_dists_oneiric_partner_binary-i386_Packages ]
then sudo -v; sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -s -c) partner"
else echo "repository already exists."
fi
sudo -v; sudo apt-get update
#Check if curl is installed
c=curl
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if git-core is installed
c=git-core
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if gnupg is installed
c=gnupg
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if flex is installed
c=flex
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if bison is installed
c=bison
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if gperf is installed
c=gperf
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libsdl1.2-dev is installed
c=libsdl1.2-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libesd0-dev is installed
c=libesd0-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libwxgtk2.6-dev is installed
c=libwxgtk2.6-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if squashfs-tools is installed
c=squashfs-tools
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if build-essential is installed
c=build-essential
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if zip is installed
c=zip
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if libncurses5-dev is installed
c=libncurses5-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if zlib1g-dev is installed
c=zlib1g-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if sun-java6-jdk is installed
c=sun-java6-jdk
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if pngcrush is installed
c=pngcrush
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if schedtool is installed
c=schedtool
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if g++-multilib is installed
c=g++-multilib
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if lib32z1-dev is installed
c=lib32z1-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if lib32ncurses5-dev is installed
c=lib32ncurses5-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if lib32readline5-dev is installed
c=lib32readline5-dev
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if gcc-4.3-multilib is installed
c=gcc-4.3-multilib
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
#Check if g++-4.3-multilib is installed
c=g++-4.3-multilib
echo "checking if $c is installed" 2>&1
if [[ $(dpkg-query -f'${Status}' --show $c 2>/dev/null) = *\ installed ]];
then
echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo -v; sudo apt-get --force-yes -y install $c 2>/dev/null
fi
fi
if [ "$OS" = "archlinux" ]; then
x=`pacman -Qs curl`
c=curl
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs git`
c=git
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs gnupg`
c=gnupg
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs flex`
c=flex
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs bison`
c=bison
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs gperf`
c=gperf
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs sdl`
c=sdl
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs audiofile`
c=audiofile
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs wxgtk`
c=wxgtk
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs squashfs-tools`
c=squashfs-tools
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs base-devel`
c=base-devel
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs zip`
c=zip
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs ncurses`
c=ncurses
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs zlib`
c=zlib
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs openjdk-7-jre-headless`
c=openjdk-7-jre-headless
if [ -n "$x" ]
then echo "$c is installed. Uninstalling."
sudo pacman -Rdd --noconfirm $c
else
echo "$c was not found, skipping..." 2>&1
fi
x=`pacman -Qs jdk7-openjdk`
c=jdk7-openjdk
if [ -n "$x" ]
then echo "$c is installed. Uninstalling."
sudo pacman -Rdd --noconfirm $c
else
echo "$c was not found, skipping..." 2>&1
fi
x=`pacman -Qs openjdk6`
c=openjdk6
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs glibc`
c=glibc
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs pngcrush`
c=pngcrush
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
wget http://aur.archlinux.org/packages/pn/pngcrush/pngcrush.tar.gz; tar xvzf pngcrush.tar.gz; cd pngcrush; rm PKGBUILD; wget http://aur.archlinux.org/packages/pn/pngcrush/PKGBUILD; makepkg -f; ls *x86_64.pkg.tar.xz |xargs sudo pacman --noconfirm -U; cd ..; rm -rf pngcrush/; rm pngcrush*
fi
x=`pacman -Qs schedtool`
c=schedtool
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-gcc-libs`
c=lib32-gcc-libs
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-glibc`
c=lib32-glibc
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs lib32-readline`
c=lib32-readline
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs make`
c=make
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs perl`
c=perl
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
x=`pacman -Qs perl-switch`
c=perl-switch
if [ -n "$x" ]
then echo "$c already installed. Skipping."
else
echo "$c was not found, installing..." 2>&1
sudo pacman -S --noconfirm $c
fi
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2 /usr/bin/python
fi
#Check for ~/bin
if [ ! -d ~/bin ]
then
mkdir ~/bin
else
echo "~/bin already exists. Skipping."
fi
#Set ~/bin to path
if grep -q /home/$USER/bin /home/$USER/.bashrc;
then
echo "$HOME/bin set up already."
else
echo "PATH=$PATH:$HOME/bin" >> $HOME/.bashrc
fi
while true; do
read -p "Do you wish to set up or change your git information? (Do this at least once)" yn
case $yn in
[Yy]* )
echo "Please enter a name for the git-repo to identify you by (eg: David Tennant):";
read input_variable;
git config --global user.name "$input_variable";
echo "Please enter an email address below for git-repo (eg: test@test.com): ";
read input_variable;
git config --global user.email "$input_variable";
break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > $HOME/bin/repo;
chmod a+x $HOME/bin/repo;
mkdir $HOME/aokp;
cd $HOME/aokp;
X=`awk '/^processor/ { N++} END { print N }' /proc/cpuinfo`;
bash -c "cd $HOME/aokp && repo init -u https://github.com/AOKP/platform_manifest.git -b ics"
bash -c "repo sync -j$X"
bash -c "curl -o prebuilt/android-arm/kernel/LINUX_KERNEL_COPYING -O https://raw.github.com/ezterry/kernel-biff-testing/ezgb-2636/COPYING"
bash -c "install -d prebuilt/android-arm/kernel"
. build/envsetup.sh && lunch aokp_toro-userdebug && make otapackage -j$X
if [ "$OS" = "archlinux" ]; then
read -p "Please press enter to restore python3 to your default python"
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3 /usr/bin/python
fi
;;
#############################################################
#############################################################
10 )
clear
echo "1 - This option will resolve the missing dependencies required the installs to function properly"
echo " - depending on your mirror download speed this can take a long time to complete."
echo "2 - Installs the Android SDK to /usr/local/android-sdk and the"
echo " Android NDK to the directory /usr/local/android/ndk"
echo "3 - This installs the adb and fastboot, accessible from terminal at any location. If you have"
echo " trouble installing this please type the following command in terminal:"
echo " /usr/local/android-sdk/tools/android update sdk"
echo "4 - Adds right click to adb push support to Nautilus. Files will be pushed"
echo " to the /sdcard/Download/ folder on your phone."
echo "5 - Installs MTP support for the Galaxy Nexus to Linux. Use the commands: android-connect and"
echo " android-disconnect to mount and unmount your device to /home/$USER/GalaxyNexus"
echo "6 - Downloads or updates your 99-android.rules file to the /etc/udev/rules.d/ directory."
echo "7 - This installs aapt and apktool to /usr/local/bin/ accessible anywhere."
echo " http://code.google.com/p/android-apktool/"
echo "8 - This installs git-repo to /usr/local/bin/repo (Please note: This requires Python 2.x)"
echo " http://code.google.com/p/git-repo/"
echo "9 - This will attempt to compile the Android Open Kang Project (AOKP) from source. WARNING:"
echo " This required 17 GB of space to compile while I was testing it."
echo "Please press enter to continue."
read enter
;;
#############################################################
#############################################################
0 ) exit ;;
* ) echo "Please choose from the list above"
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment