Codebase list google-nexus-tools / upstream/4.6.1
Import upstream version 4.6.1 Kali Janitor 3 years ago
10 changed file(s) with 311 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/x86_64 processor is required on all platforms, except macOS³.
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/).* ²*Chrome OS 75 or newer is required for [USB support](https://www.androidpolice.com/2019/06/26/chrome-os-75/).* ³*Platform tools run in Rosetta 2 compatibility layer on Apple Silicon Macs, because Google doesn't provide native ARM binaries.*
15
16 ### How to install
17
18 Nexus Tools does not need to be downloaded, just paste this command into the terminal:
19
420 ```
5 bash <(curl https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh)
21 bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh)
622 ```
7 and this command to un-install Nexus Tools:
23
24 To uninstall, run this command:
25
826 ```
9 bash <(curl https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/uninstall.sh)
27 bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/uninstall.sh)
1028 ```
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).
1229
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.
30 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.
1431
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.
32 ### Analytics
1633
17 ---------------------------------------
34 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:
1835
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/)
36 ```
37 bash <(curl -s https://raw.githubusercontent.com/corbindavenport/nexus-tools/master/install.sh) no-analytics
38 ```
2239
2340 ---------------------------------------
2441
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 ANALYTICS=$1
23
24 # Function for copying udex.txt to proper location
25 _install_udev() {
26 # Install UDEV file
27 if [ ! -d /etc/udev/rules.d/ ]; then
28 sudo mkdir -p /etc/udev/rules.d/
29 fi
30 if [ -f "$UDEV" ]; then
31 sudo rm "$UDEV"
32 fi
33 echo "[ .. ] Downloading UDEV file..."
34 sudo curl -Lfk --progress-bar -o "$UDEV" "$UDEVURL"
35 output=$(sudo chmod 644 $UDEV 2>&1) && echo "[ OK ] UDEV permissions fixed." || { echo "[EROR] $output"; }
36 output=$(sudo chown root: $UDEV 2>&1) && echo "[ OK ] UDEV ownership fixed." || { echo "[EROR] $output"; }
37 # Restart services
38 sudo udevadm control --reload-rules 2>/dev/null >&2
39 sudo service udev restart 2>/dev/null >&2
40 sudo killall adb 2>/dev/null >&2
41 }
42
43 # Function for installing USB Vendor ID list (required for some devices to connect)
44 # More info: https://apkudo.com/one-true-adb_usb-ini-to-rule-them-all/
45 _install_ini() {
46 if [ ! -d $HOME/.android/ ]; then
47 mkdir -p $HOME/.android/
48 fi
49 if [ -f "$HOME/.android/adb_usb.ini" ]; then
50 rm "$HOME/.android/adb_usb.ini"
51 fi
52 echo "[ .. ] Downloading ADB Vendor ID file..."
53 curl -Lfk --progress-bar -o "$HOME/.android/adb_usb.ini" "$INIURL"
54 }
55
56 # Function for adding Nexus Tools directory to $PATH
57 _add_path() {
58 if [[ ":$PATH:" == *":$DIR:"* ]]; then
59 # Nexus Tools directory already in $PATH
60 echo "[ OK ] $DIR/ is already in PATH."
61 else
62 # Nexus Tools directory needs to be added to $PATH
63 if [[ "$SHELL" =~ "zsh" ]]; then
64 echo 'export PATH=$PATH:'$DIR >> $HOME/.zshrc
65 source "$HOME/.zshrc"
66 echo "[ OK ] Z Shell detected, added $DIR/ to $HOME/.zshrc."
67 elif [[ "$SHELL" =~ "bash" ]]; then
68 echo 'export PATH=$PATH:'$DIR >> $HOME/.bashrc
69 source "$HOME/.bashrc"
70 echo "[ OK ] Bash shell detected, added $DIR/ to $HOME/.bashrc."
71 else
72 echo "[WARN] Shell could not be detected, you will need to manually add $DIR to your PATH."
73 fi
74 fi
75 }
76
77 # Function for Google Analytics
78 _analytics() {
79 if [ "$ANALYTICS" != "no-analytics" ]; then
80 # Generate random user ID string
81 if [ -x "$(command -v uuidgen)" ]; then
82 UUID=$(uuidgen)
83 elif [ -f "/proc/sys/kernel/random/uuid" ]; then
84 UUID=$(cat /proc/sys/kernel/random/uuid)
85 else
86 UUID="00000000-0000-0000-0000-000000000000"
87 fi
88 # Get exact OS
89 if [ -d "/mnt/c/Windows" ]; then
90 REALOS="Windows"
91 elif [ -d "/usr/share/themes/CrosAdapta" ]; then
92 REALOS="ChromeOS"
93 else
94 REALOS="$OS"
95 fi
96 # Make curl request
97 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"
98 else
99 echo "[ OK ] Google Analytics are disabled."
100 fi
101 }
102
103 # Function for opening completion webpage
104 _open_webpage() {
105 if [ -d "/mnt/c/Windows" ]; then
106 /mnt/c/Windows/explorer.exe "https://corbin.io/nexus-tools-exit.html" &>/dev/null &
107 elif [ "$OS" = "Darwin" ]; then
108 open "https://corbin.io/nexus-tools-exit.html" &>/dev/null &
109 else
110 xdg-open "https://corbin.io/nexus-tools-exit.html" &>/dev/null &
111 fi
112 }
113
114 # Start the script
115 echo "[INFO] Nexus Tools 4.6"
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
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
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
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
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
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!"
153 elif [ "$ARCH" = "arm64" ] && [ "$OS" = "Darwin" ]; then
154 echo "[WARN] Google doesn't provide native Apple Silicon binaries yet, x86_64 binaries will be installed."
164155 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
156 echo "[EROR] Your hardware platform is detected as $ARCH, but Google only provides Platform Tools for x86-based platforms."
157 echo "[EROR] Installation cannot continue."
158 echo " "
159 exit
160 fi
161
162 # Detect operating system and install
163 if [ -d "/mnt/c/Windows" ]; then # Windows 10 Bash
164 echo "[WARN] Bash on Windows 10 doesn't support USB devices, you'll only be able to use ADB over Wi-Fi."
165 ZIP="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
166 # Download the ZIP file
167 echo "[ .. ] Downloading platform tools for x86 Linux..."
168 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; }
169 # Unzip it
170 unzip -q -o "$DIR/temp.zip" -d "$DIR"
171 # Move all files from the zip to $DIR
172 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
173 # Delete the zip file and original folder
174 rm "$DIR/temp.zip"
175 rmdir "$DIR/platform-tools"
176 echo "[ OK ] Platform Tools now installed in $DIR."
177 # Add Nexus Tools directory to $PATH
178 _add_path
179 # Mark binaries in directory as executable
180 chmod -f +x $DIR/*
181 # Download Device ID list
182 _install_ini
183 # Download udev list
184 echo "[INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
185 echo "[INFO] Sudo access is required. Press ENTER to proceed or X to skip."
186 read -sn1 udevinput
187 [ "$udevinput" = "" ] && _install_udev
188 elif [ "$OS" = "Darwin" ]; then # macOS
189 ZIP="https://dl.google.com/android/repository/platform-tools-latest-darwin.zip"
190 # Download the ZIP file
191 echo "[ .. ] Downloading platform tools for macOS..."
192 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; }
193 # Unzip it
194 unzip -q -o "$DIR/temp.zip" -d "$DIR"
195 # Move all files from the zip to $DIR
196 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
197 # Delete the zip file and original folder
198 rm "$DIR/temp.zip"
199 rmdir "$DIR/platform-tools"
200 echo "[ OK ] Platform Tools now installed in $DIR."
201 # Mark binaries in directory as executable
202 chmod -f +x $DIR/*
203 # Download Device ID list
204 _install_ini
205 # Add Nexus Tools directory to $PATH
206 _add_path
207 elif [ "$OS" = "Linux" ]; then # Generic Linux
208 if [ -d "/usr/share/themes/CrosAdapta" ]; then
209 echo "[WARN] Chrome OS 75 or higher is required for USB support."
210 fi
211 ZIP="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
212 # Download the ZIP file
213 echo "[ .. ] Downloading platform tools for x86 Linux..."
214 curl -Lfk --progress-bar -o "$DIR/temp.zip" "$ZIP"|| { echo "[EROR] Download failed."; }
215 # Unzip it
216 unzip -q -o "$DIR/temp.zip" -d "$DIR"
217 # Move all files from the zip to $DIR
218 mv -f -v $DIR/platform-tools/* $DIR > /dev/null
219 # Delete the zip file and original folder
220 rm "$DIR/temp.zip"
221 rmdir "$DIR/platform-tools"
222 echo "[ OK ] Platform Tools now installed in $DIR."
223 # Add Nexus Tools directory to $PATH
224 _add_path
225 # Mark binaries in directory as executable
226 chmod -f +x $DIR/*
227 # Download Device ID list
228 _install_ini
229 # Download udev list
230 echo "[INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
231 echo "[INFO] Sudo access is required. Press ENTER to proceed or X to skip."
232 read -sn1 udevinput
233 [ "$udevinput" = "" ] && _install_udev
234 else
235 echo "[EROR] Your OS or CPU architecture doesn't seem to be supported."
236 echo "[EROR] Detected OS: $OS"
237 echo "[EROR] Detected arch: $ARCH"
238 exit
239 fi
240
241 # All done
242 _open_webpage
243 echo "[INFO] Installation complete! Open a new Terminal window to apply changes."
244 echo " "
245 exit
+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 ""