Codebase list google-nexus-tools / upstream/4.4
Import upstream version 4.4 Kali Janitor 3 years ago
10 changed file(s) with 313 addition(s) and 246 deletion(s). Raw diff Collapse all Expand all
0 ![alt text](http://i.imgur.com/shjM51Q.png "Nexus Tools")
1 ===========
0 # Nexus Tools
21
3 Nexus Tools is an installer for the Android debug/development command-line tools ADB (Android Device Bridge) and Fastboot for Mac OS X, Linux, and Google Chrome/Chromium OS. The script does not need to be downloaded, simply copy and paste this command into the terminal and run it to install Nexus Tools:
2 Nexus Tools is a simple installer for the [Android SDK Platform Tools](https://developer.android.com/studio/releases/platform-tools) package, which includes [ADB](https://developer.android.com/studio/command-line/adb.html), Fastboot, [Systrace](https://developer.android.com/studio/profile/systrace-commandline.html), and other applications.
3
4 Installing these tools requires downloading the proper files, extracting them somewhere, and [adding the files' folder to your system's path](https://askubuntu.com/a/60221). Nexus Tools does all that hard work for you, and installs additional configuration files to fix common USB problems.
5
6 ### Features
7
8 * Works on Linux, Bash for Windows 10¹, Linux on Chromebooks², and Mac. An x86 processor is required on all platforms.
9 * The SDK Platform Tools package is downloaded from Google's servers, so you're always getting the latest version.
10 * All files are stored in `~/.nexustools`, so sudo access is not required.
11 * A [USB Vendor ID list](https://apkudo.com/one-true-adb_usb-ini-to-rule-them-all/) and [UDEV rules file](https://github.com/M0Rf30/android-udev-rules/blob/master/51-android.rules) are installed to fix common USB connection issues (UDEV file only applies to Linux and is optional).
12 * Can be easily removed.
13
14 ¹*Windows Subsystem for Linux doesn't support USB connections. However, it is possible to use ADB over a Wi-Fi connection using a [third-party app](https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb) or [Android 11+](https://www.androidpolice.com/2020/03/18/android-11-developer-preview-2-fully-supports-wireless-adb/).*
15
16 ²*Chrome OS 75 or newer is required for [USB support](https://www.androidpolice.com/2019/06/26/chrome-os-75/).*
17
18 ### How to install
19
20 Nexus Tools does not need to be downloaded, just paste this command into the terminal:
21
422 ```
5 bash <(curl https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh)
23 bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh)
624 ```
7 and this command to un-install Nexus Tools:
25
26 To uninstall, run this command:
27
828 ```
9 bash <(curl https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/uninstall.sh)
29 bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/uninstall.sh)
1030 ```
11 These commands will download the selected script and run it. The script will download the files it needs during runtime, so it requires an internet connection. The script works on both Mac OS X and Linux (as long as the curl package is installed).
1231
13 Support for Google Chrome OS is experimental at this time, as I was only able to test it on a build of Chromium for x86 PCs. I don't have an actual Chromebook to test it on, but Nexus Tools should work correctly on both x86 and ARM Chromebooks.
32 Once Nexus Tools is finished, you can run `adb`, `fastboot`, and other commands straight from the terminal. **You may need to open a new terminal window for changes to take effect.** To update, just run the installer again.
1433
15 Nexus Tools requires sudo privileges to install/uninstall the adb and fastboot tools to /usr/bin, so they can be run without typing the full directory.
34 ### Analytics
1635
17 ---------------------------------------
36 Nexus Tools uses Google Analytics to transmit your operating system and CPU architecture during the installation process. This data is not sold or shared in any way, it's only for me to know which hardware platforms I should focus my attention on. You can disable Google Analytics by adding the `no-analytics` parameter to the install command, like this:
1837
19 __XDA Thread:__ [http://forum.xda-developers.com/showthread.php?t=2564453](http://forum.xda-developers.com/showthread.php?t=2564453)
20
21 __XDA Article:__ [http://www.xda-developers.com/android/set-up-adb-and...](http://www.xda-developers.com/android/set-up-adb-and-fastboot-on-linux-mac-os-x-and-chrome-os-with-a-single-command/)
38 ```
39 bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh) no-analytics
40 ```
2241
2342 ---------------------------------------
2443
bin/linux-arm-adb less more
Binary diff not shown
bin/linux-arm-fastboot less more
Binary diff not shown
bin/linux-i386-adb less more
Binary diff not shown
bin/linux-i386-fastboot less more
Binary diff not shown
bin/mac-adb less more
Binary diff not shown
bin/mac-fastboot less more
Binary diff not shown
1212
1313 #!/bin/bash
1414
15 ADB="/usr/bin/adb"
16 FASTBOOT="/usr/bin/fastboot"
15 DIR="$HOME/.nexustools"
1716 UDEV="/etc/udev/rules.d/51-android.rules"
17 UDEVURL="https://raw.githubusercontent.com/M0Rf30/android-udev-rules/master/51-android.rules"
18 INIURL="https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini"
1819 OS=$(uname)
19 ARCH=$(arch)
20
21 # get sudo
22
23 echo "[INFO] Nexus Tools 2.3"
24 echo "[INFO] Please enter sudo password for install."
25 sudo echo "[ OK ] Sudo access granted."
26
27 # check if already installed
28
29 if [ -f $ADB ]; then
30 read -p "[WARN] ADB is already present, press ENTER to overwrite or exit to cancel."
31 sudo rm $ADB
32 fi
33 if [ -f $FASTBOOT ]; then
34 read -p "[WARN] Fastboot is already present, press ENTER to overwrite or exit to cancel."
35 sudo rm $FASTBOOT
36 fi
37
38 # detect operating system and install
39
40 if [ -x "/usr/bin/crossystem" ]; then # Chrome OS
41 sudo mount -o remount,rw / 2>/dev/null
42 if [ "$?" -ne "0" ]; then
43 if [ -x /usr/local/bin ]; then
44 ADB=/usr/local/bin/adb
45 FASTBOOT=/usr/local/bin/fastboot
46 UDEV=
47 fi
48 /usr/bin/crossystem 'mainfw_type?developer'
49 fi
50 if [ "$?" -ne "0" ]; then
51
52 echo "[INFO] It appears your Chromium/Chrome OS device is not in developer mode."
53 echo "[INFO] Developer mode is needed to install ADB and Fastboot."
54 echo "[INFO] Make sure your device is booted in developer mode."
55 echo "[INFO] To set up developer tools, use this command: sudo dev_install"
56 echo " "
57 exit 1
58 fi
59 case "$(arch)" in
60 i*86|amd64|x86_64)
61 echo "[INFO] Downloading ADB for Chrome OS [Intel CPU]..."
62 sudo curl -s -o $ADB "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-i386-adb" -LOk
63 echo "[INFO] Downloading Fastboot for Chrome [Intel CPU]..."
64 sudo curl -s -o $FASTBOOT "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-i386-fastboot" -LOk
65 ;;
66 arm|armv*)
67 echo "[WARN] The ADB binaries for ARM are out of date, and do not work on Android 4.2.2+"
68 echo "[INFO] Downloading ADB for Chrome OS [ARM CPU]..."
69 sudo curl -s -o $ADB "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-arm-adb" -LOk
70 echo "[INFO] Downloading Fastboot for Chrome OS [ARM CPU]..."
71 sudo curl -s -o $FASTBOOT "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-arm-fastboot" -LOk
72 ;;
73 *)
74 echo "[EROR] Your CPU platform could not be detected."
75 echo " "
76 exit 1
77 esac
78 echo "[INFO] Downloading udev list..."
79 if [ -n "$UDEV" ]; then
80 if [ ! -d /etc/udev/ ]; then
81 sudo mkdir /etc/udev/
82 fi
83 if [ ! -d /etc/udev/rules.d/ ]; then
84 sudo mkdir /etc/udev/rules.d/
85 fi
86 sudo curl -s -o $UDEV "http://github.com/corbindavenport/nexus-tools/raw/master/udev.txt" -LOk
87 sudo chmod 644 $UDEV
88 sudo chown root. $UDEV 2>/dev/null
89 sudo service udev restart 2>/dev/null
90 sudo killall adb 2>/dev/null
91 fi
92 echo "[INFO] Making ADB and Fastboot executable..."
93 sudo chmod +x $ADB
94 sudo chmod +x $FASTBOOT
95 echo "[ OK ] Done!"
96 echo "[INFO] Type adb or fastboot to run."
97 echo " "
98 exit 0
99 elif [ "$(uname)" == "Darwin" ]; then # Mac OS X
100 echo "[INFO] Downloading ADB for Mac OS X..."
101 sudo curl -s -o $ADB "http://github.com/corbindavenport/nexus-tools/raw/master/bin/mac-adb" -LOk
102 echo "[INFO] Downloading Fastboot for Mac OS X..."
103 sudo curl -s -o $FASTBOOT "http://github.com/corbindavenport/nexus-tools/raw/master/bin/mac-fastboot" -LOk
104 echo "[INFO] Making ADB and Fastboot executable..."
105 echo "[INFO] Downloading udev list..."
106 if [ -n "$UDEV" ]; then
107 if [ ! -d /etc/udev/ ]; then
108 sudo mkdir /etc/udev/
109 fi
110 if [ ! -d /etc/udev/rules.d/ ]; then
111 sudo mkdir /etc/udev/rules.d/
112 fi
113 sudo curl -s -o $UDEV "http://github.com/corbindavenport/nexus-tools/raw/master/udev.txt" -LOk
114 sudo chmod 644 $UDEV
115 sudo chown root. $UDEV 2>/dev/null
116 sudo service udev restart 2>/dev/null
117 sudo killall adb 2>/dev/null
118 fi
119 echo "[INFO] Making ADB and Fastboot executable..."
120 sudo chmod +x $ADB
121 sudo chmod +x $FASTBOOT
122 echo "[ OK ] Done!"
123 echo "[INFO] Type adb or fastboot to run."
124 echo " "
125 exit 0
126 elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then # Generic Linux
127 if [ "$(arch)" == "i386" ] || [ "$(arch)" == "i486" ] || [ "$(arch)" == "i586" ] || [ "$(arch)" == "amd64" ] || [ "$(arch)" == "x86_64" ] || [ "$(arch)" == "i686" ]; then # Linux on Intel x86/x86_64 CPU
128 echo "[INFO] Downloading ADB for Linux [Intel CPU]..."
129 sudo curl -s -o $ADB "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-i386-adb" -LOk
130 echo "[INFO] Downloading Fastboot for Linux [Intel CPU]..."
131 sudo curl -s -o $FASTBOOT "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-i386-fastboot" -LOk
132 elif [ "$(arch)" == "arm" ] || [ "$(arch)" == "armv6l" ]; then # Linux on ARM CPU
133 echo "[WARN] The ADB binaries for ARM are out of date, and do not work on Android 4.2.2+"
134 echo "[INFO] Downloading ADB for Linux [ARM CPU]..."
135 sudo curl -s -o $ADB "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-arm-adb" -LOk
136 echo "[INFO] Downloading Fastboot for Linux [ARM CPU]..."
137 sudo curl -s -o $FASTBOOT "http://github.com/corbindavenport/nexus-tools/raw/master/bin/linux-arm-fastboot" -LOk
138 else
139 echo "[EROR] Your CPU platform could not be detected."
140 echo " "
141 exit 1
142 fi
143 echo "[INFO] Downloading udev list..."
144 if [ -n "$UDEV" ]; then
145 if [ ! -d /etc/udev/ ]; then
146 sudo mkdir /etc/udev/
147 fi
148 if [ ! -d /etc/udev/rules.d/ ]; then
149 sudo mkdir /etc/udev/rules.d/
150 fi
151 sudo curl -s -o $UDEV "http://github.com/corbindavenport/nexus-tools/raw/master/udev.txt" -LOk
152 sudo chmod 644 $UDEV
153 sudo chown root. $UDEV 2>/dev/null
154 sudo service udev restart 2>/dev/null
155 sudo killall adb 2>/dev/null
156 fi
157 echo "[INFO] Making ADB and Fastboot executable..."
158 sudo chmod +x $ADB
159 sudo chmod +x $FASTBOOT
160 echo "[ OK ] Done!"
161 echo "[INFO] Type adb or fastboot to run."
162 echo " "
163 exit 0
20 ARCH=$(uname -m)
21 BASEURL="https://github.com/corbindavenport/nexus-tools/raw/master"
22 XCODE=0
23 ANALYTICS=$1
24
25 # Function for copying udex.txt to proper location
26 _install_udev() {
27 # Install UDEV file
28 if [ ! -d /etc/udev/rules.d/ ]; then
29 sudo mkdir -p /etc/udev/rules.d/
30 fi
31 if [ -f "$UDEV" ]; then
32 sudo rm "$UDEV"
33 fi
34 echo "[ .. ] Downloading UDEV file..."
35 sudo curl -Lfk --progress-bar -o "$UDEV" "$UDEVURL"
36 output=$(sudo chmod 644 $UDEV 2>&1) && echo "[ OK ] UDEV permissions fixed." || { echo "[EROR] $output"; XCODE=1; }
37 output=$(sudo chown root: $UDEV 2>&1) && echo "[ OK ] UDEV ownership fixed." || { echo "[EROR] $output"; XCODE=1; }
38 # Restart services
39 sudo udevadm control --reload-rules 2>/dev/null >&2
40 sudo service udev restart 2>/dev/null >&2
41 sudo killall adb 2>/dev/null >&2
42 }
43
44 # Function for installing USB Vendor ID list (required for some devices to connect)
45 # More info: https://apkudo.com/one-true-adb_usb-ini-to-rule-them-all/
46 _install_ini() {
47 if [ ! -d $HOME/.android/ ]; then
48 mkdir -p $HOME/.android/
49 fi
50 if [ -f "$HOME/.android/adb_usb.ini" ]; then
51 rm "$HOME/.android/adb_usb.ini"
52 fi
53 echo "[ .. ] Downloading ADB Vendor ID file..."
54 curl -Lfk --progress-bar -o "$HOME/.android/adb_usb.ini" "$INIURL"
55 }
56
57 # Function for adding Nexus Tools directory to $PATH
58 _add_path() {
59 if [[ ":$PATH:" == *":$DIR:"* ]]; then
60 # Nexus Tools directory already in $PATH
61 echo "[ OK ] $DIR/ is already in PATH."
62 else
63 # Nexus Tools directory needs to be added to $PATH
64 if [[ $SHELL == *"bash"* ]]; then
65 echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc
66 source "$HOME/.bashrc"
67 echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc."
68 elif [[ $SHELL == *"zsh"* ]]; then
69 echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc
70 source "$HOME/.zshrc"
71 echo "[ OK ] Z Shell detected, added $DIR/ to $HOME/.zshrc."
72 else
73 echo "[WARN] Shell could not be detected, you will need to manually add $DIR to your PATH."
74 fi
75 fi
76 }
77
78 # Function for reporting bugs
79 _report_bug() {
80 echo "[EROR] Your CPU architecture or operating system could not be detected."
81 echo "[EROR] Report bugs at: github.com/corbindavenport/nexus-tools/issues"
82 echo "[EROR] Please include the following information in the bug report:"
83 echo "[EROR] OS: $OS"
84 echo "[EROR] ARCH: $ARCH"
85 echo " "
86 }
87
88 # Function for Google Analytics
89 _analytics() {
90 if [ "$ANALYTICS" != "no-analytics" ]; then
91 # Generate random user ID string
92 if [ -x "$(command -v uuidgen)" ]; then
93 UUID=$(uuidgen)
94 elif [ -f "/proc/sys/kernel/random/uuid" ]; then
95 UUID=$(cat /proc/sys/kernel/random/uuid)
96 else
97 UUID="00000000-0000-0000-0000-000000000000"
98 fi
99 # Get exact OS
100 if [ -d "/mnt/c/Windows" ]; then
101 REALOS="Windows"
102 elif [ -d "/usr/share/themes/CrosAdapta" ]; then
103 REALOS="ChromeOS"
104 else
105 REALOS="$OS"
106 fi
107 # Make curl request
108 curl -s -o /dev/null "https://www.google-analytics.com/collect?v=1&t=pageview&tid=UA-74707662-1&cid=$UUID&dp=$REALOS%2F$ARCH"
109 else
110 echo "[ OK ] Google Analytics are disabled."
111 fi
112 }
113
114 # Start the script
115 echo "[INFO] Nexus Tools 4.4"
116
117 # Check that required applications are installed
118 if ! [ -x "$(command -v curl)" ]; then
119 echo "[EROR] The 'curl' command is not installed. Please install it and run Nexus Tools again."
120 exit 1
121 fi
122 if ! [ -x "$(command -v unzip)" ]; then
123 echo "[EROR] The 'unzip' command is not installed. Please install it and run Nexus Tools again."
124 exit 1
125 fi
126
127 # Start Analytics
128 _analytics
129
130 # Delete existing Nexus Tools installation if it exists
131 if [ -d $DIR ]; then
132 echo "[WARN] Platform tools already installed in $DIR. Press ENTER to overwrite or X to cancel."
133 read -sn1 input
134 [ "$input" = "" ] && rm -rf $DIR || exit 1
135 fi
136
137 # Make the new directory
138 mkdir -p $DIR
139
140 # Check if platform tools are already installed
141 if [ -x "$(command -v adb)" ]; then
142 echo "[EROR] ADB is already installed and Nexus Tools cannot remove it automatically. Please manually uninstall ADB and try again."
143 exit 1
144 fi
145 if [ -x "$(command -v fastboot)" ]; then
146 echo "[EROR] Fastboot is already installed and Nexus Tools cannot remove it automatically. Please manually uninstall Fastboot and try again."
147 exit 1
148 fi
149
150 # Block installation on non-x86 platforms
151 if [ "$ARCH" = "i386" ] || [ "$ARCH" = "i486" ] || [ "$ARCH" = "i586" ] || [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i686" ]; then
152 echo "[ OK ] Your hardware platform is supported, yay!"
164153 else
165 echo "[EROR] Your operating system or architecture could not be detected."
166 echo "[EROR] Report bugs at: github.com/corbindavenport/nexus-tools/issues"
167 echo "[EROR] Report the following information in the bug report:"
168 echo "[EROR] OS: $OS"
169 echo "[EROR] ARCH: $ARCH"
170 echo " "
171 exit 1
172 fi
154 echo "[EROR] Your hardware platform is detected as $ARCH, but Google only provides Platform Tools for x86-based platforms."
155 echo "[EROR] Installation cannot continue."
156 echo " "
157 exit 1
158 fi
159
160 # Detect operating system and install
161 if [ -d "/mnt/c/Windows" ]; then # Windows 10 Bash
162 echo "[WARN] Bash on Windows 10 doesn't support USB devices, you'll only be able to use ADB over Wi-Fi."
163 ZIP="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
164 # Download the ZIP file
165 echo "[ .. ] Downloading platform tools for x86 Linux..."
166 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; XCODE=1; }
167 # Unzip it
168 unzip -q -o "$DIR/temp.zip" -d "$DIR"
169 # Move all files from the zip to $DIR
170 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
171 # Delete the zip file and original folder
172 rm "$DIR/temp.zip"
173 rmdir "$DIR/platform-tools"
174 echo "[ OK ] Platform Tools now installed in $DIR."
175 # Add Nexus Tools directory to $PATH
176 _add_path
177 # Mark binaries in directory as executable
178 chmod -f +x $DIR/*
179 # Download Device ID list
180 _install_ini
181 # Download udev list
182 echo "[INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
183 echo "[INFO] Sudo access is required. Press ENTER to proceed or X to skip."
184 read -sn1 udevinput
185 [ "$udevinput" = "" ] && _install_udev
186 elif [ "$OS" = "Darwin" ]; then # macOS
187 ZIP="https://dl.google.com/android/repository/platform-tools-latest-darwin.zip"
188 # Download the ZIP file
189 echo "[ .. ] Downloading platform tools for macOS..."
190 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; XCODE=1; }
191 # Unzip it
192 unzip -q -o "$DIR/temp.zip" -d "$DIR"
193 # Move all files from the zip to $DIR
194 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
195 # Delete the zip file and original folder
196 rm "$DIR/temp.zip"
197 rmdir "$DIR/platform-tools"
198 echo "[ OK ] Platform Tools now installed in $DIR."
199 # Mark binaries in directory as executable
200 chmod -f +x $DIR/*
201 # Download Device ID list
202 _install_ini
203 # Add Nexus Tools directory to $PATH
204 _add_path
205 elif [ "$OS" = "Linux" ]; then # Generic Linux
206 if [ -d "/usr/share/themes/CrosAdapta" ]; then
207 echo "[WARN] Chrome OS 75 or higher is required for USB support."
208 fi
209 ZIP="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
210 # Download the ZIP file
211 echo "[ .. ] Downloading platform tools for x86 Linux..."
212 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; XCODE=1; }
213 # Unzip it
214 unzip -q -o "$DIR/temp.zip" -d "$DIR"
215 # Move all files from the zip to $DIR
216 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
217 # Delete the zip file and original folder
218 rm "$DIR/temp.zip"
219 rmdir "$DIR/platform-tools"
220 echo "[ OK ] Platform Tools now installed in $DIR."
221 # Add Nexus Tools directory to $PATH
222 _add_path
223 # Mark binaries in directory as executable
224 chmod -f +x $DIR/*
225 # Download Device ID list
226 _install_ini
227 # Download udev list
228 echo "[INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
229 echo "[INFO] Sudo access is required. Press ENTER to proceed or X to skip."
230 read -sn1 udevinput
231 [ "$udevinput" = "" ] && _install_udev
232 else
233 _report_bug
234 exit 1
235 fi
236
237 # All done
238 if [ $XCODE -eq 0 ]; then
239 echo "[INFO] Installation complete! Open a new Terminal window to apply changes."
240 echo "[INFO] Donate to support development: bit.ly/donatenexustools or patreon.com/corbindavenport"
241 else
242 _report_bug
243 fi
244 echo " "
245 exit $XCODE
+0
-31
udev.txt less more
0 SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
1 SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
2 SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
3 SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
4 SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
5 SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
6 SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
7 SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
8 SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
9 SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
10 SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
11 SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
12 SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
13 SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
14 SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
15 SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
16 SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
17 SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
18 SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
19 SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
20 SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
21 SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
22 SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
23 SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
24 SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
25 SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
26 SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
27 SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
28 SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
29 SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
30 SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
1212
1313 #!/bin/bash
1414
15 ADB="/usr/bin/adb"
16 FASTBOOT="/usr/bin/fastboot"
17 UDEV="/etc/udev/rules.d/51-android.rules"
15 OS=$(uname)
16 ARCH=$(uname -m)
1817
19 # get sudo
20
21 echo "[INFO] Nexus Tools 2.3"
22 echo "[INFO] Please enter sudo password for uninstall."
23 sudo echo "[ OK ] Sudo access granted."
24
25 # check for chrome os
26
27 if [ -x "/usr/bin/crossystem" ]; then # Chrome OS
28 sudo mount -o remount,rw / 2>/dev/null
29 if [ "$?" -ne "0" ]; then
30 if [ -x /usr/local/bin ]; then
31 ADB=/usr/local/bin/adb
32 FASTBOOT=/usr/local/bin/fastboot
33 UDEV=
34 fi
35 /usr/bin/crossystem 'mainfw_type?developer'
36 fi
37 if [ "$?" -ne "0" ]; then
38 echo "[INFO] It appears your Chromium/Chrome OS device is not in developer mode."
39 echo "[INFO] Developer mode is needed to install ADB and Fastboot."
40 echo "[INFO] Make sure your device is booted in developer mode."
41 echo "[INFO] To set up developer tools, use this command: sudo dev_install"
42 echo " "
43 exit 1
44 fi
18 # Nexus Tools 3.2+ (August 2016-Now) installs binaries in ~/.nexustools
19 if [ -d $HOME/.nexustools ]; then
20 echo "[WARN] Nexus Tools folder found in $HOME/.nexustools. Press ENTER to delete or X to skip."
21 read -sn1 input
22 [ "$input" = "" ] && rm -rf $HOME/.nexustools
23 echo "[ OK ] Deleted $HOME/.nexustools"
4524 fi
4625
47 # remove files
26 # Nexus Tools 2.8-3.1 (October 2015-August 2016) installed binaries in /user/local/bin
27 if [ -f /usr/local/bin/adb ]; then
28 echo "[WARN] ADB found in /usr/local/bin. It may have been installed there by an old version of Nexus Tools."
29 echo "[WARN] Sudo access is required to remove. Press ENTER to delete or X to skip."
30 read -sn1 input
31 [ "$input" = "" ] && sudo rm /usr/local/bin/adb
32 echo "[ OK ] Deleted /usr/local/bin/adb"
33 fi
34 if [ -f /usr/local/bin/fastboot ]; then
35 echo "[WARN] Fasboot found in /usr/local/bin. It may have been installed there by an old version of Nexus Tools."
36 echo "[WARN] Sudo access is required to remove. Press ENTER to delete or X to skip."
37 read -sn1 input
38 [ "$input" = "" ] && sudo rm /usr/local/bin/fastboot
39 echo "[ OK ] Deleted /usr/local/bin/fastboot"
40 fi
4841
49 if [ -f $ADB ]; then
50 sudo rm $ADB
51 echo "[ OK ] ADB removed."
52 else
53 echo "[EROR] ADB not found in /usr/bin, skipping uninstall."
42 # Nexus Tools 1.0-2.7.1 (December 2013-October 2015) installed binaries in /usr/bin
43 if [ -f /usr/bin/adb ]; then
44 echo "[WARN] ADB found in /usr/bin. It may have been installed there by an old version of Nexus Tools."
45 echo "[WARN] Sudo access is required to remove. Press ENTER to delete or X to skip."
46 read -sn1 input
47 [ "$input" = "" ] && sudo rm /usr/bin/adb
48 echo "[ OK ] Deleted /usr/bin/adb"
5449 fi
55 if [ -f $FASTBOOT ]; then
56 sudo rm $FASTBOOT
57 echo "[ OK ] Fastboot removed."
58 else
59 echo "[EROR] Fastboot not found in /usr/bin, skipping uninstall."
50 if [ -f /usr/bin/fastboot ]; then
51 echo "[WARN] Fasboot found in /usr/bin. It may have been installed there by an old version of Nexus Tools."
52 echo "[WARN] Sudo access is required to remove. Press ENTER to delete or X to skip."
53 read -sn1 input
54 [ "$input" = "" ] && sudo rm /usr/bin/fastboot
55 echo "[ OK ] Deleted /usr/bin/fastboot"
6056 fi
61 if [ -f $UDEV ]; then
62 sudo rm $UDEV
63 echo "[ OK ] Udev list removed."
64 else
65 echo "[EROR] Udev list not found in /etc/udev/rules.d/, skipping uninstall."
57
58 # Uninstall Device ID list
59 if [ -f $HOME/.android/adb_usb.ini ]; then
60 rm $HOME/.android/adb_usb.ini
61 echo "[ OK ] Deleted $HOME/.android/adb_usb.ini"
6662 fi
67 echo "[ OK ] Done uninstalling."
68 echo " "
63
64 # Uninstall UDEV file
65 if [ -f /etc/udev/rules.d/51-android.rules ]; then
66 echo "[WARN] UDEV list found. It may have been installed there by Nexus Tools."
67 echo "[WARN] Sudo access is required to remove. Press ENTER to delete or X to skip."
68 read -sn1 input
69 [ "$input" = "" ] && sudo rm /etc/udev/rules.d/51-android.rules
70 echo "[ OK ] Deleted /etc/udev/rules.d/51-android.rules"
71 fi
72
73 echo "[ OK ] Uninstall complete."
74 echo ""