aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-mirrors/APKBUILD
blob: 5064546cdc8057d60a5537db9c0636a5b4f8b0fa (plain)
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
# Contributor: Matt Smith <mcs@darkregion.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alpine-mirrors
pkgver=3.5.9
pkgrel=0
pkgdesc="List of Alpine Linux Mirrors"
url="https://alpinelinux.org/"
arch="noarch"
license="MIT"
depends=""
checkdepends="curl"
install=""
subpackages=""
source="mirrors.yaml"

build() {
	cd "$srcdir"
	awk '$1 == "-" && $2 ~ /^http:/ {print $2}' mirrors.yaml > MIRRORS.txt
}

check() {
	cd "$srcdir"
	local failed=""
	for i in $(cat MIRRORS.txt); do
		msg "testing $i"
		curl --head --connect-timeout 10 $i >/dev/null \
			|| failed="$failed $i"
	done
	if [ -n "$failed" ]; then
		error "Following mirrors failed:"
		for i in $failed; do
			echo $i
		done
		return 1
	fi
}

package() {
	install -D -m644 "$srcdir"/mirrors.yaml \
		"$pkgdir"/usr/share/alpine-mirrors/mirrors.yaml || return 1
	install -D -m644 "$srcdir"/MIRRORS.txt \
		"$pkgdir"/usr/share/alpine-mirrors/MIRRORS.txt || return 1
}

sha512sums="f6a2a3cca0392b47061e038e5c3c02d4f526a6ef8a4c9dffa464bdafcd5a30422947d2d30ef0d60c2a27437ea482a36ca8ec142e500c9974cecd642a2c74bcb7  mirrors.yaml"