This repository has been archived by the owner on Apr 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TL00H.sh
executable file
·148 lines (125 loc) · 3.38 KB
/
TL00H.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
# @Author: [email protected]
# @Date: 2016.06.21
# @Last Modified by: anchen
# @Last Modified time: 2016.06.19
echo "请输入开始查询的版本号(推荐从 `cat $PWD/TL00H/NewVerID` `cat $PWD/TL00H/NewVer` 开始):"
read v
echo "请输入结束查询的版本号:"
read e
if [ ! $v ]&&[ ! $e ]; then
echo "你没有输入要查询的版本号,程序即将退出."
exit 0
fi
Filter(){
if [[ $1 == "1" ]]; then
File="$PWD/TL00H/$i.xml"
Size=`ls -il $File | awk '{print $6}'`
if [ $Size -le "162" ] || [ $Size == "1500" ];then
echo "----------------------------------------------"
echo "This is Not to Download File, Will be Deleted!"
echo "File:$File"
echo "Size:$Size"
rm $File
echo "----------------------------------------------"
fi
else
for f in `ls $PWD/TL00H`; do
File=`ls -il $PWD/TL00H/$f | awk '{print $10}'`
Size=`ls -il $PWD/TL00H/$f | awk '{print $6}'`
if [ $Size -le "162" ] || [ $Size == "1500" ];then
echo "----------------------------------------------"
echo "This is Not to Download File, Will be Deleted!"
echo "File:$File"
echo "Size:$Size"
rm $File
echo "----------------------------------------------"
fi
done
fi
}
Filter
GetCount=0
declare -i GetCount
MaxCount=100
declare -i MaxCount
download_url="http://update.hicloud.com:8180/TDS/data/files/p3/s15/G1022/g223"
for ((i=$v;i<$e;i++));do
if [ $GetCount != $MaxCount ]; then
echo
echo "正在查询版本 v$i,若想终止直接关闭窗口"
echo
changelog_url="$download_url/v$i/f1/full/changelog.xml"
curl $changelog_url > $PWD/TL00H/$i.xml
Filter 1
GetCount=GetCount+1
else
echo "Stop 30s"
sleep 30
GetCount=0
fi
done
echo "可下载版本:"
#for xml in `find $PWD/TL00H`;do
# vs=(`basename -s .xml $xml`)
# vars=(${vs[*]})
# echo "${vars[*]}"
#done
vs=(`find $PWD/TL00H -name *.xml`)
vars=(`basename -s .xml ${vs[*]}`)
sort_vars=($(for sv in "${vars[@]}";do echo "$sv"; done | sort))
echo "${sort_vars[*]}"
num="${#sort_vars[@]}"
NewVer=(${sort_vars[$(($num - 1))]})
NewVer(){
export "$1"
}
nver=`grep -n "B" $PWD/TL00H/$NewVer.xml | awk '{print $4}'`
NewVer $nver
echo $version >$PWD/TL00H/NewVer
echo $NewVer >$PWD/TL00H/NewVerID
echo "请输入要下载的版本:"
read var
if [ ! $var ]; then
echo "你没有输入要下载的版本,程序即将退出."
exit 0
fi
echo "请选择下载工具例如: axel curl wget"
read d
update_zip="$download_url/v$var/f1/full/update.zip"
precheck_script="$download_url/v$var/f1/full/precheck-script"
Downloader(){
val=($@)
mkdir -p HwOUC/$var
if [[ `command -v $1` ]]; then
if [ "${#val[@]}" > "1" ]; then
cd HwOUC/$var
$@ $update_zip
cd ..
$@ $precheck_script
else
cd HwOUC/$var
$1 $update_zip
cd ..
$1 $precheck_script
fi
else
echo "Not Install $1!"
fi
}
case $d in
"axel")
val='-n 16'
;;
# "curl")
# val=""
# ;;
# "wget")
# val=""
# ;;
*)
echo "如果你的下载工具有参数要求,请输入你的参数,没有请直接回车."
read val
;;
esac
Downloader $d $val