Codebase list google-nexus-tools / upstream/4.3
Import upstream version 4.3 Kali Janitor 3 years ago
10 changed file(s) with 312 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 [ -f "$HOME/.bashrc" ]; then
65 echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc
66 source "$HOME/.bashrc"
67 echo "[ OK ] Added $DIR/ to $HOME/.bashrc."
68 fi
69 if [ -f "$HOME/.zshrc" ]; then
70 echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc
71 source "$HOME/.zshrc"
72 echo "[ OK ] Added $DIR/ to $HOME/.zshrc."
73 fi
74 fi
75 }
76
77 # Function for reporting bugs
78 _report_bug() {
79 echo "[EROR] Your CPU architecture or operating system could not be detected."
80 echo "[EROR] Report bugs at: github.com/corbindavenport/nexus-tools/issues"
81 echo "[EROR] Please include the following information in the bug report:"
82 echo "[EROR] OS: $OS"
83 echo "[EROR] ARCH: $ARCH"
84 echo " "
85 }
86
87 # Function for Google Analytics
88 _analytics() {
89 if [ "$ANALYTICS" != "no-analytics" ]; then
90 # Generate random user ID string
91 if [ -x "$(command -v uuidgen)" ]; then
92 UUID=$(uuidgen)
93 elif [ -f "/proc/sys/kernel/random/uuid" ]; then
94 UUID=$(cat /proc/sys/kernel/random/uuid)
95 else
96 UUID="00000000-0000-0000-0000-000000000000"
97 fi
98 # Get exact OS
99 if [ -d "/mnt/c/Windows" ]; then
100 REALOS="Windows"
101 elif [ -d "/usr/share/themes/CrosAdapta" ]; then
102 REALOS="ChromeOS"
103 else
104 REALOS="$OS"
105 fi
106 # Make curl request
107 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"
108 else
109 echo "[ OK ] Google Analytics are disabled."
110 fi
111 }
112
113 # Start the script
114 echo "[INFO] Nexus Tools 4.3"
115
116 # Check that required applications are installed
117 if ! [ -x "$(command -v curl)" ]; then
118 echo "[EROR] The 'curl' command is not installed. Please install it and run Nexus Tools again."
119 exit 1
120 fi
121 if ! [ -x "$(command -v unzip)" ]; then
122 echo "[EROR] The 'unzip' command is not installed. Please install it and run Nexus Tools again."
123 exit 1
124 fi
125
126 # Start Analytics
127 _analytics
128
129 # Delete existing Nexus Tools installation if it exists
130 if [ -d $DIR ]; then
131 echo "[WARN] Platform tools already installed in $DIR. Press ENTER to overwrite or X to cancel."
132 read -sn1 input
133 [ "$input" = "" ] && rm -rf $DIR || exit 1
134 fi
135
136 # Make the new directory
137 mkdir -p $DIR
138
139 # Check if platform tools are already installed
140 if [ -x "$(command -v adb)" ]; then
141 echo "[EROR] ADB is already installed and Nexus Tools cannot remove it automatically. Please manually uninstall ADB and try again."
142 exit 1
143 fi
144 if [ -x "$(command -v fastboot)" ]; then
145 echo "[EROR] Fastboot is already installed and Nexus Tools cannot remove it automatically. Please manually uninstall Fastboot and try again."
146 exit 1
147 fi
148
149 # Block installation on non-x86 platforms
150 if [ "$ARCH" = "i386" ] || [ "$ARCH" = "i486" ] || [ "$ARCH" = "i586" ] || [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "i686" ]; then
151 echo "[ OK ] Your hardware platform is supported, yay!"
164152 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
153 echo "[EROR] Your hardware platform is detected as $ARCH, but Google only provides Platform Tools for x86-based platforms."
154 echo "[EROR] Installation cannot continue."
155 echo " "
156 exit 1
157 fi
158
159 # Detect operating system and install
160 if [ -d "/mnt/c/Windows" ]; then # Windows 10 Bash
161 echo "[WARN] Bash on Windows 10 doesn't support USB devices, you'll only be able to use ADB over Wi-Fi."
162 ZIP="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
163 # Download the ZIP file
164 echo "[ .. ] Downloading platform tools for x86 Linux..."
165 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; XCODE=1; }
166 # Unzip it
167 unzip -q -o "$DIR/temp.zip" -d "$DIR"
168 # Move all files from the zip to $DIR
169 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
170 # Delete the zip file and original folder
171 rm "$DIR/temp.zip"
172 rmdir "$DIR/platform-tools"
173 echo "[ OK ] Platform Tools now installed in $DIR."
174 # Add Nexus Tools directory to $PATH
175 _add_path
176 # Mark binaries in directory as executable
177 chmod -f +x $DIR/*
178 # Download Device ID list
179 _install_ini
180 # Download udev list
181 echo "[INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
182 echo "[INFO] Sudo access is required. Press ENTER to proceed or X to skip."
183 read -sn1 udevinput
184 [ "$udevinput" = "" ] && _install_udev
185 elif [ "$OS" = "Darwin" ]; then # macOS
186 ZIP="https://dl.google.com/android/repository/platform-tools-latest-darwin.zip"
187 # Download the ZIP file
188 echo "[ .. ] Downloading platform tools for macOS..."
189 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; XCODE=1; }
190 # Unzip it
191 unzip -q -o "$DIR/temp.zip" -d "$DIR"
192 # Move all files from the zip to $DIR
193 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
194 # Delete the zip file and original folder
195 rm "$DIR/temp.zip"
196 rmdir "$DIR/platform-tools"
197 echo "[ OK ] Platform Tools now installed in $DIR."
198 # Mark binaries in directory as executable
199 chmod -f +x $DIR/*
200 # Download Device ID list
201 _install_ini
202 # Add Nexus Tools directory to $PATH
203 _add_path
204 elif [ "$OS" = "Linux" ]; then # Generic Linux
205 if [ -d "/usr/share/themes/CrosAdapta" ]; then
206 echo "[WARN] Chrome OS 75 or higher is required for USB support."
207 fi
208 ZIP="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
209 # Download the ZIP file
210 echo "[ .. ] Downloading platform tools for x86 Linux..."
211 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; XCODE=1; }
212 # Unzip it
213 unzip -q -o "$DIR/temp.zip" -d "$DIR"
214 # Move all files from the zip to $DIR
215 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
216 # Delete the zip file and original folder
217 rm "$DIR/temp.zip"
218 rmdir "$DIR/platform-tools"
219 echo "[ OK ] Platform Tools now installed in $DIR."
220 # Add Nexus Tools directory to $PATH
221 _add_path
222 # Mark binaries in directory as executable
223 chmod -f +x $DIR/*
224 # Download Device ID list
225 _install_ini
226 # Download udev list
227 echo "[INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
228 echo "[INFO] Sudo access is required. Press ENTER to proceed or X to skip."
229 read -sn1 udevinput
230 [ "$udevinput" = "" ] && _install_udev
231 else
232 _report_bug
233 exit 1
234 fi
235
236 # All done
237 if [ $XCODE -eq 0 ]; then
238 echo "[INFO] Installation complete! You may need to open a new Terminal window for commands to work."
239 echo "[INFO] Donate to support development: bit.ly/donatenexustools or patreon.com/corbindavenport"
240 else
241 _report_bug
242 fi
243 echo " "
244 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 ""