Created
January 30, 2014 03:41
-
-
Save redacted/8702132 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
#!/bin/bash | |
ADB="/usr/bin/adb" | |
FASTBOOT="/usr/bin/fastboot" | |
# get sudo | |
echo "[INFO] Nexus Tools 1.2.1" | |
echo "[INFO] Please enter sudo password for adb/fastboot install" | |
sudo echo "[ OK ] Sudo access granted." | |
# check if already installed | |
if [ -f $ADB ]; then | |
read -p "[INFO] ADB is already present, press ENTER to overwrite or exit to cancel." | |
sudo rm $ADB | |
fi | |
if [ -f $FASTBOOT ]; then | |
read -p "[INFO] Fastboot is already present, press ENTER to overwrite or exit to cancel." | |
sudo rm $FASTBOOT | |
fi | |
# detect operating system and install | |
if [ -f "/usr/bin/old_bins/chromeos-tpm-recovery" ]; then # Chrome OS | |
sudo mount -o remount,rw / | |
if [ "$?" -ne "0" ]; then | |
echo "[WARN] It appears your Chrome OS device is not rooted. Having root privliges is needed to install ADB and Fastboot." | |
echo "[INFO] Run the following command to root" | |
echo "sudo /usr/share/vboot/bin/make_dev_ssd.sh --force --remove_rootfs_verification" | |
echo " " | |
exit 0 | |
fi | |
if [ "$(arch)" == "arm" ]; then # Chrome OS on ARM CPU | |
OS_NAME="Chrome OS ARM" | |
ADB_URL="http://github.com/corbindavenport/nexus-tools/blob/master/chromeos/adb-arm?raw=true" | |
FASTBOOT_URL="http://github.com/corbindavenport/nexus-tools/blob/master/chromeos/fastboot-arm?raw=true" | |
else # Chrome OS on Intel CPU | |
OS_NAME="Chrome OS Intel" | |
ADB_URL="http://github.com/corbindavenport/nexus-tools/blob/master/chromeos/adb-x86?raw=true" | |
FASTBOOT_URL="http://github.com/corbindavenport/nexus-tools/blob/master/chromeos/fastboot-x86?raw=true" | |
fi | |
elif [ "$(uname)" == "Darwin" ]; then # Mac OS X | |
OS_NAME="Mac OS X" | |
ADB_URL="http://github.com/corbindavenport/nexus-tools/blob/master/macosx/adb?raw=true" | |
FASTBOOT_URL="http://github.com/corbindavenport/nexus-tools/blob/master/macosx/fastboot?raw=true" | |
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then # Linux | |
OS_NAME="Linux" | |
ADB_URL="http://github.com/corbindavenport/nexus-tools/blob/master/linux/adb?raw=true" | |
FASTBOOT_URl="http://github.com/corbindavenport/nexus-tools/blob/master/linux/fastboot?raw=true" | |
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then # Cygwin on Windows | |
echo "[WARN] Nexus Tools Installer currently not compatible with Cygwin. Now exiting." | |
echo " " | |
exit 0 | |
fi | |
if [ -n "$ADB_URL" ]; then | |
# now we get the files | |
echo "[INFO] Downloading tools for" $OS_NAME | |
sudo curl -s -o $ADB $ADB_URL -LOk | |
sudo curl -s -o $FASTBOOT $FASTBOOT_URL -LOk | |
# and make them executable | |
echo "[INFO] Making ADB and Fastboot executable..." | |
sudo chmod +x $ADB | |
sudo chmod +x $FASTBOOT | |
echo "[ OK ] Done!" | |
echo "[INFO] Type adb or fastboot to run." | |
echo " " | |
exit 0 | |
fi | |
# we shouldn't get here, but just in case | |
echo "[WARN] Install failed..." | |
echo " " | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment