@@ -20,7 +20,6 @@ INIURL="https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini"
20
20
OS=$( uname)
21
21
ARCH=$( uname -m)
22
22
BASEURL=" https://github.com/corbindavenport/nexus-tools/raw/master"
23
- DIST=$( awk -F= ' /^NAME/{print $2}' /etc/os-release)
24
23
XCODE=0
25
24
26
25
# Function for copying udex.txt to proper location
@@ -85,8 +84,24 @@ _report_bug() {
85
84
echo " "
86
85
}
87
86
87
+ # Function for Google Analytics
88
+ _analytics () {
89
+ # Generate random user ID string
90
+ UUID=$( uuidgen)
91
+ # Get exact OS
92
+ if [ -d " /mnt/c/Windows" ]; then
93
+ REALOS=" Windows"
94
+ elif [ -d " /usr/share/themes/CrosAdapta" ]; then
95
+ REALOS=" ChromeOS"
96
+ else
97
+ REALOS=" $OS "
98
+ fi
99
+ # Make curl request
100
+ curl -s -o /dev/null " https://www.google-analytics.com/collect?v=1&t=event&tid=UA-74707662-1&cid=$UUID &dp=$REALOS %2F$ARCH "
101
+ }
102
+
88
103
# Start the script
89
- echo " [INFO] Nexus Tools 4.1 "
104
+ echo " [INFO] Nexus Tools 4.2 "
90
105
91
106
# Check that required applications are installed
92
107
if ! [ -x " $( command -v curl) " ]; then
@@ -98,6 +113,9 @@ if ! [ -x "$(command -v unzip)" ]; then
98
113
exit 1
99
114
fi
100
115
116
+ # Start Analytics
117
+ _analytics
118
+
101
119
# Delete existing Nexus Tools installation if it exists
102
120
if [ -d $DIR ]; then
103
121
echo " [WARN] Platform tools already installed in $DIR . Press ENTER to overwrite or X to cancel."
@@ -118,6 +136,16 @@ if [ -x "$(command -v fastboot)" ]; then
118
136
exit 1
119
137
fi
120
138
139
+ # Block installation on non-x86 platforms
140
+ if [ " $ARCH " == " i386" ] || [ " $ARCH " == " i486" ] || [ " $ARCH " == " i586" ] || [ " $ARCH " == " amd64" ] || [ " $ARCH " == " x86_64" ] || [ " $ARCH " == " i686" ]; then
141
+ echo " [ OK ] Your hardware platform is supported, yay!"
142
+ else
143
+ echo " [EROR] Your hardware platform is detected as $ARCH , but Google only provides Platform Tools for x86-based platforms."
144
+ echo " [EROR] Installation cannot continue."
145
+ echo " "
146
+ exit 1
147
+ fi
148
+
121
149
# Detect operating system and install
122
150
if [ -d " /mnt/c/Windows" ]; then # Windows 10 Bash
123
151
echo " [WARN] Bash on Windows 10 doesn't support USB devices, you'll only be able to use ADB over Wi-Fi."
@@ -167,43 +195,35 @@ elif [ "$OS" == "Linux" ]; then # Generic Linux
167
195
if [ -d " /usr/share/themes/CrosAdapta" ]; then
168
196
echo " [WARN] Chrome OS 75 or higher is required for USB support."
169
197
fi
170
- if [ " $ARCH " == " i386" ] || [ " $ARCH " == " i486" ] || [ " $ARCH " == " i586" ] || [ " $ARCH " == " amd64" ] || [ " $ARCH " == " x86_64" ] || [ " $ARCH " == " i686" ]; then # Linux on Intel x86/x86_64 CPU
171
- ZIP=" https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
172
- # Download the ZIP file
173
- echo " [ .. ] Downloading platform tools for x86 Linux..."
174
- curl -Lfk --progress-bar -o " $DIR /temp.zip" " $ZIP " || { echo " [EROR] Download failed." ; XCODE=1; }
175
- # Unzip it
176
- unzip -q -o " $DIR /temp.zip" -d " $DIR "
177
- # Move all files from the zip to $DIR
178
- mv -f -v $DIR /platform-tools/* $DIR > /dev/null
179
- # Delete the zip file and original folder
180
- rm " $DIR /temp.zip"
181
- rmdir " $DIR /platform-tools"
182
- echo " [ OK ] Platform Tools now installed in $DIR ."
183
- # Add Nexus Tools directory to $PATH
184
- _add_path
185
- # Mark binaries in directory as executable
186
- chmod -f +x $DIR /*
187
- # Download Device ID list
188
- _install_ini
189
- # Download udev list
190
- echo " [INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
191
- echo " [INFO] Sudo access is required. Press ENTER to proceed or X to skip."
192
- read -sn1 udevinput
193
- [ " $udevinput " = " " ] && _install_udev
194
- elif [ " $ARCH " == " arm" ] || [ " $ARCH " == " armv6l" ] || [ " $ARCH " == " armv7l" ]; then # Linux on ARM CPU
195
- echo " [EROR] Google does not provide Platform Tools for ARM Linux. Installation cannot continue."
196
- echo " "
197
- exit 1
198
- else
199
- _report_bug
200
- exit 1
201
- fi
198
+ ZIP=" https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
199
+ # Download the ZIP file
200
+ echo " [ .. ] Downloading platform tools for x86 Linux..."
201
+ curl -Lfk --progress-bar -o " $DIR /temp.zip" " $ZIP " || { echo " [EROR] Download failed." ; XCODE=1; }
202
+ # Unzip it
203
+ unzip -q -o " $DIR /temp.zip" -d " $DIR "
204
+ # Move all files from the zip to $DIR
205
+ mv -f -v $DIR /platform-tools/* $DIR > /dev/null
206
+ # Delete the zip file and original folder
207
+ rm " $DIR /temp.zip"
208
+ rmdir " $DIR /platform-tools"
209
+ echo " [ OK ] Platform Tools now installed in $DIR ."
210
+ # Add Nexus Tools directory to $PATH
211
+ _add_path
212
+ # Mark binaries in directory as executable
213
+ chmod -f +x $DIR /*
214
+ # Download Device ID list
215
+ _install_ini
216
+ # Download udev list
217
+ echo " [INFO] Nexus Tools can install UDEV rules to fix potential USB issues."
218
+ echo " [INFO] Sudo access is required. Press ENTER to proceed or X to skip."
219
+ read -sn1 udevinput
220
+ [ " $udevinput " = " " ] && _install_udev
202
221
else
203
222
_report_bug
204
223
exit 1
205
224
fi
206
- # All done!
225
+
226
+ # All done
207
227
if [ $XCODE -eq 0 ]; then
208
228
echo " [INFO] Installation complete! You may need to open a new Terminal window for commands to work."
209
229
echo " [INFO] Donate to support development: bit.ly/donatenexustools or patreon.com/corbindavenport"
0 commit comments