-
-
Notifications
You must be signed in to change notification settings - Fork 10
144 lines (128 loc) · 6.27 KB
/
update-list.yml
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
name: Sync mirror
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
List:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Display structure of downloaded files
run: |
function exceptions()
{
if [[ $k == *albony* ]]; then
COUNTRY=India
CITY="Nagpur"
FLAG="https://cdn.ipwhois.io/flags/in.svg"
fi
if [[ $k == *stpete* ]]; then
COUNTRY=Russia
CITY="Saint Petersburg"
FLAG="https://cdn.ipwhois.io/flags/ru.svg"
fi
if [[ $k == *aliyun* ]]; then
COUNTRY=China
CITY=Hangzhou
FLAG="https://cdn.ipwhois.io/flags/cn.svg"
fi
if [[ $k == *nju.edu* ]]; then
COUNTRY=China
CITY=Nanjing
FLAG="https://cdn.ipwhois.io/flags/cn.svg"
fi
if [[ $k == *imola.armbian* ]]; then
COUNTRY=Slovenia
CITY=Ljubljana
FLAG="https://cdn.ipwhois.io/flags/si.svg"
fi
if [[ $k == *kr.mirrors.naho* ]]; then
COUNTRY=Korea
CITY=Seoul
FLAG="https://cdn.ipwhois.io/flags/kr.svg"
fi
if [[ $k == *jp.mirrors.naho* ]]; then
COUNTRY=Japan
CITY=Tokyo
FLAG="https://cdn.ipwhois.io/flags/jp.svg"
fi
}
function show_mirrors()
{
MIRRORS=$1
echo -en "\n## $2\n\n"
echo "|URL |City |Flag|Country|"
echo "|:--|:--|:--:|--:|"
for k in ${MIRRORS[@]}
do
HOST=$(echo "$k" | awk -F/ '{print $3}')
IP=$(dig +short $HOST | tail -1)
RES=$(
curl --max-time 5 -s http://ipwhois.app/json/${IP} | \
jq '.timezone, .city, .country, .country_flag' | \
while read -r TIMEZONE; do
read -r COUNTRY
echo "${TIMEZONE},${COUNTRY},${COUNTRYFLAG}" | tr --delete \"
done
)
TZDATA=$(echo ${RES} | cut -d"," -f1)
CITY=$(echo ${RES} | cut -d"," -f2)
COUNTRY=$(echo ${RES} | cut -d"," -f3 | xargs)
FLAG=$(echo ${RES} | cut -d"," -f4)
# automation is not perfect
exceptions
echo "|$k|$CITY|<img width=24 src=$FLAG>|$COUNTRY|"
done
}
echo '<h3 align=center><a href="#build-tools"><img src="https://raw.githubusercontent.com/armbian/build/master/.github/armbian-logo.png" alt="Armbian logo" width="144"></a><br>mirror sync</h3>' > README.md
echo -en "<p align=right> </p>\n" >> README.md
#echo -en "\n[![Sync mirror](https://github.com/armbian/mirror/actions/workflows/mirror-sync.yml/badge.svg)](https://github.com/armbian/mirror/actions/workflows/mirror-sync.yml) [![Rootfs sync](https://github.com/armbian/mirror/actions/workflows/rootfs-sync.yml/badge.svg)](https://github.com/armbian/mirror/actions/workflows/rootfs-sync.yml)" >> README.md
echo "
## Mirroring Armbian?
We are providing rsync service for stable images (dl), repository (apt), beta (beta) and archive (archive) at:
rsync -av rsync://rsync.armbian.com/
Alternatively you can sync most valuable date from one of our mirror that provides rsync and is much faster:
rsync -av rsync://mirrors.dotsrc.org/armbian-dl
rsync -av rsync://mirrors.dotsrc.org/armbian-apt
Space needs: 500Gb (images), 100Gb (packages) and (optional) 3TB for archives
1. Setup HTTP and HTTPS hostname
2. Setup cron to sync every 2-4 hours
3. [Inform us](https://www.armbian.com/#contact)
" >> README.md
MIR=$(curl -sq http://redirect.armbian.com/mirrors | jq -Mr '.' | grep http | tr -d \"," " | sort | uniq)
show_mirrors "$MIR" "Images (dl.armbian.com)" >> README.md
echo "" >> README.md
MIR=$(curl -sq http://apt.armbian.com/mirrors | jq -Mr '.' | grep http | tr -d \"," " | sort | uniq)
show_mirrors "$MIR" "Packages (apt.armbian.com)" >> README.md
echo "" >> README.md
MIR=$(curl -sq http://archive.armbian.com/mirrors | jq -Mr '.' | grep http | tr -d \"," " | sort | uniq)
show_mirrors "$MIR" "Archive (archive.armbian.com)" >> README.md
echo "" >> README.md
MIR=$(curl -sq https://beta.armbian.com/mirrors | jq -Mr '.' | grep http | tr -d \"," " | sort | uniq)
show_mirrors "$MIR" "Beta (beta.armbian.com)" >> README.md
echo "" >> README.md
MIR=$(curl -sq https://cache.armbian.com/mirrors | jq -Mr '.' | grep http | tr -d \"," " | sort | uniq)
show_mirrors "$MIR" "Cache (cache.armbian.com)" >> README.md
echo "" >> README.md
#if [[ $(cat *.log | awk -F ',' '{print $2}' | sort | uniq -c | sort -n | wc -l) -gt 0 ]]; then
#echo -en "\n## Mirrors error count\n" >> README.md
#cat *.log | awk -F ',' '{print $2}' | sort | uniq -c | sort -n >> README.md
#echo -en "\n\n[Detailed report](detailed.txt)" >> README.md
#find *.log -not -empty -type f -print0 | xargs -0 -I % sh -c 'cat % | cut -d"," -f2-3 |tr -d \"," " ' | sort > detailed.txt
#fi
- name: Add
run: |
git pull
git add README.md
git add detailed.txt
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "Armbianworker"
git commit --allow-empty -m "Update github actions" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MIRROR }}
branch: ${{ github.ref }}