-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_wade
51 lines (46 loc) · 1.2 KB
/
script_wade
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
#!/bin/bash
export GITHUB_TOKEN=github_pat_CHANGEME
wget --quiet --wait 2 --random-wait https://download.lineageos.org/wade
awk 'BEGIN{
RS="</a>"
IGNORECASE=1
}
{
for(o=1;o<=NF;o++){
if ( $o ~ /href/){
gsub(/.*href=\042/,"",$o)
gsub(/\042.*/,"",$o)
print $(o)
}
}
}' wade | grep mirrorbits | head -4 > list_of_wade
github-release info --user alpenamilch \
--repo backup_microg_lineageos \
| grep artifact > current_files_in_github
for i in `cat list_of_wade`
do
echo $i
echo "Downloading zip"
wget --quiet --wait 2 --random-wait $i
done
for i in `find . -type f \( -iname lineage\*m -o -iname lineage\*.zip -o -iname lineage\*img -o -iname lineage\*256 \) -printf '%f\n'`
do
rename -f 's/\?/./g' "${i}"
done
echo "Uploading "
for i in `find . -type f \( -iname lineage\*m -o -iname lineage\*.zip -o -iname lineage\*img -o -iname lineage\*256 \) -printf '%f\n'`
do
if grep $i current_files_in_github > /dev/null
then
echo $i " exists in github"
rm -f $i
else
echo $i " is a new file"
github-release upload --user alpenamilch \
--repo backup_microg_lineageos \
--tag wade \
--file $i --name $i
rm -fr $i
sleep 1
fi
done