forked from phhusson/super-bootimg
-
Notifications
You must be signed in to change notification settings - Fork 25
/
checkNexus.sh
43 lines (37 loc) · 1.28 KB
/
checkNexus.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#Stable
regexp='https://dl.google.com/dl/android/aosp/([a-z]+)-([a-z0-9]{3}[0-9]{2}[a-z])-factory-[0-9a-f]*.tgz'
curl -s https://developers.google.com/android/nexus/images |
grep -F '<a href="https://dl.google.com/dl/android/aosp/'|
grep -oE "$regexp" |
while read url;do
device="$( sed -E 's|'"$regexp"'|\1|g' <<<$url )"
releaseLower="$( sed -E 's|'"$regexp"'|\2|g' <<<$url )"
release="$( sed -E 's|'"$regexp"'|\2|g' <<<$url |tr a-z A-Z)"
filename="known-imgs/nexus/${device}/${release}"
[ -f $filename ] && continue
mkdir -p $(dirname $filename)
cat > $filename << EOF
$url
image-$device-${releaseLower}.zip
boot.img
EOF
done
#N preview
regexp='([a-z]+)-([a-z0-9]{3}[0-9]{2}[a-z])-factory-[0-9a-f]*.tgz'
curl -s http://developer.android.com/preview/download.html |
grep -oE "$regexp" |
while read archive;do
url="http://storage.googleapis.com/androiddevelopers/shareables/preview/${archive}"
device="$( sed -E 's|'"$regexp"'|\1|g' <<<$archive )"
releaseLower="$( sed -E 's|'"$regexp"'|\2|g' <<<$archive )"
release="$( sed -E 's|'"$regexp"'|\2|g' <<<$archive |tr a-z A-Z)"
filename="known-imgs/nexus/${device}/${release}"
[ -f $filename ] && continue
mkdir -p $(dirname $filename)
cat > $filename << EOF
$url
image-$device-${releaseLower}.zip
boot.img
EOF
done