forked from SDRausty/TermuxArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getimagefunctions.sh
67 lines (63 loc) · 2.08 KB
/
getimagefunctions.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash -e
# Copyright 2017-2018 by SDRausty. All rights reserved. 🌎 🌍 🌏 🌐 🗺
# Hosting https://sdrausty.github.io/TermuxArch courtesy https://pages.github.com
# https://sdrausty.github.io/TermuxArch/CONTRIBUTORS Thank you for your help.
# https://sdrausty.github.io/TermuxArch/README has information about this project.
################################################################################
ftchit ()
{
printdownloadingftchit
if [[ $dm = wget ]];then
wget $dmverbose -N --show-progress http://$mirror$path$file.md5
wget $dmverbose -c --show-progress http://$mirror$path$file
else
curl $dmverbose -C - --fail --retry 4 -O http://$mirror$path$file.md5 -O http://$mirror$path$file
fi
}
ftchstnd ()
{
printcontacting
if [[ $dm = wget ]];then
wget -v -O/dev/null $cmirror 2>gmirror
nmirror=$(grep Location gmirror | awk {'print $2'})
rm gmirror
printdone
printdownloadingftch
wget $dmverbose -N --show-progress $nmirror$path$file.md5
wget $dmverbose -c --show-progress $nmirror$path$file
else
curl -v $cmirror 2>gmirror
nmirror=$(grep Location gmirror | awk {'print $3'})
rm gmirror
printdone
printdownloadingftch
curl $dmverbose -C - --fail --retry 4 -O $nmirror$path$file.md5 -O $nmirror$path$file
fi
}
getimage ()
{
printdownloadingx86
if [[ $dm = wget ]];then
wget $dmverbose -N --show-progress http://$mirror${path}md5sums.txt
if [ $(getprop ro.product.cpu.abi) = x86 ];then
file=$(grep i686 md5sums.txt | awk {'print $2'})
else
file=$(grep boot md5sums.txt | awk {'print $2'})
fi
sed '2q;d' md5sums.txt > $file.md5
rm md5sums.txt
printdownloadingx86two
wget $dmverbose -c --show-progress http://$mirror$path$file
else
curl $dmverbose --fail --retry 4 -O http://$mirror${path}md5sums.txt
if [ $(getprop ro.product.cpu.abi) = x86 ];then
file=$(grep i686 md5sums.txt | awk {'print $2'})
else
file=$(grep boot md5sums.txt | awk {'print $2'})
fi
sed '2q;d' md5sums.txt > $file.md5
rm md5sums.txt
printdownloadingx86two
curl $dmverbose -C - --fail --retry 4 -O http://$mirror$path$file
fi
}