forked from SDRausty/TermuxArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetimagefunctions.bash
113 lines (109 loc) · 3.62 KB
/
getimagefunctions.bash
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env bash
# Copyright 2017-2020 by SDRausty. All rights reserved. 🌎 🌍 🌏 🌐 🗺
# Hosted sdrausty.github.io/TermuxArch courtesy https://pages.github.com
# https://sdrausty.github.io/TermuxArch/README has info about this project.
# https://sdrausty.github.io/TermuxArch/CONTRIBUTORS Thank you for your help.
################################################################################
_FTCHIT_() {
_PRINT_DOWNLOADING_FTCHIT_
if [[ "$DM" = aria2 ]]
then
aria2c -c -Z http://"$CMIRROR/$RPATH/$IFILE".md5 http://"$CMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = axel ]]
then
axel http://"$CMIRROR/$RPATH/$IFILE".md5
axel http://"$CMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = lftp ]]
then
lftpget -c http://"$CMIRROR/$RPATH/$IFILE".md5 http://"$CMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = wget ]]
then
wget "$DMVERBOSE" -c --show-progress -N http://"$CMIRROR/$RPATH/$IFILE".md5 http://"$CMIRROR/$RPATH/$IFILE"
else
curl "$DMVERBOSE" -C - --fail --retry 4 -OL {"http://$CMIRROR/$RPATH/$IFILE.md5,http://$CMIRROR/$RPATH/$IFILE"}
fi
}
_FTCHSTND_() {
FSTND=1
_PRINTCONTACTING_
if [[ "$DM" = aria2 ]]
then
aria2c http://"$CMIRROR" 1>"$TAMPDIR/global2localmirror"
NLCMIRROR="$(grep Redirecting "$TAMPDIR/global2localmirror" | awk {'print $8'})"
_PRINTDONE_
_PRINTDOWNLOADINGFTCH_
aria2c -c -m 4 -Z "$NLCMIRROR/$RPATH/$IFILE".md5 "$NLCMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = axel ]]
then
axel -vv http://"$CMIRROR" 1 > "$TAMPDIR/global2localmirror"
NLCMIRR="$(grep downloading "$TAMPDIR/global2localmirror" | awk {'print $5'})"
NLCMIRROR="${NLCMIRR::-3}"
_PRINTDONE_
_PRINTDOWNLOADINGFTCH_
axel -a http://"$NLCMIRROR/$RPATH/$IFILE".md5
axel -a http://"$NLCMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = lftp ]]
then
lftp -e get http://"$CMIRROR" 2>&1 | tee>"$TAMPDIR/global2localmirror"
NLCMI="$(grep direct "$TAMPDIR/global2localmirror" | awk {'print $5'})"
NLCMIRR="${NLCMI//\`}"
NLCMIRROR="${NLCMIRR//\'}"
_PRINTDONE_
_PRINTDOWNLOADINGFTCH_
lftpget -c "$NLCMIRROR/$RPATH/$IFILE".md5 "$NLCMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = wget ]]
then
wget -v -O/dev/null "$CMIRROR" 2>"$TAMPDIR/global2localmirror"
NLCMIRROR="$(grep Location "$TAMPDIR/global2localmirror" | awk {'print $2'})"
_PRINTDONE_
_PRINTDOWNLOADINGFTCH_
wget "$DMVERBOSE" -c --show-progress "$NLCMIRROR/$RPATH/$IFILE".md5 "$NLCMIRROR/$RPATH/$IFILE"
else
curl -v "$CMIRROR" &> "$TAMPDIR/global2localmirror"
NLCMIRROR="$(grep Location "$TAMPDIR/global2localmirror" | awk {'print $3'})"
NLCMIRROR="${NLCMIRROR%$'\r'}" # remove trailing carrage return: strip bash variable of non printing characters
_PRINTDONE_
_PRINTDOWNLOADINGFTCH_
curl "$DMVERBOSE" -C - --fail --retry 4 -OL {"$NLCMIRROR/$RPATH/$IFILE.md5,$NLCMIRROR/$RPATH/$IFILE"}
fi
}
_GETIMAGE_() {
_PRINTDOWNLOADINGX86_
if [[ "$DM" = aria2 ]]
then
aria2c http://"$CMIRROR/$RPATH/$IFILE".md5
_ISX86_
aria2c -c http://"$CMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = axel ]]
then
axel http://"$CMIRROR/$RPATH/$IFILE".md5
_ISX86_
axel http://"$CMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = lftp ]]
then
lftpget http://"$CMIRROR/$RPATH"/md5sums.txt
_ISX86_
lftpget -c http://"$CMIRROR/$RPATH/$IFILE"
elif [[ "$DM" = wget ]]
then
wget "$DMVERBOSE" -N --show-progress http://"$CMIRROR/$RPATH/"md5sums.txt
_ISX86_
wget "$DMVERBOSE" -c --show-progress http://"$CMIRROR/$RPATH/$IFILE"
else
curl "$DMVERBOSE" --fail --retry 4 -OL http://"$CMIRROR/$RPATH"/md5sums.txt
_ISX86_
curl "$DMVERBOSE" -C - --fail --retry 4 -OL http://"$CMIRROR/$RPATH/$IFILE"
fi
}
_ISX86_() {
if [[ "$CPUABI" = "$CPUABIX86" ]]
then
IFILE="$(grep i686 md5sums.txt | awk {'print $2'})"
else
IFILE="$(grep boot md5sums.txt | awk {'print $2'})"
fi
sed '2q;d' md5sums.txt > "$IFILE".md5
rm md5sums.txt
_PRINTDOWNLOADINGX86TWO_
}
## getimagefunctions.bash EOF