This commit is contained in:
parent
6105013f96
commit
8120c3fcfc
3 changed files with 71 additions and 0 deletions
26
alpine-mirror/APKBUILD
Normal file
26
alpine-mirror/APKBUILD
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
|
||||||
|
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
|
||||||
|
pkgname=alpine-mirror
|
||||||
|
pkgver=1.0.0
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="your own personal mirror of alpine"
|
||||||
|
url="https://git.ddd.rip/ptrcnull/aports"
|
||||||
|
arch="noarch"
|
||||||
|
license="BSD-2-Clause"
|
||||||
|
depends="rsync"
|
||||||
|
source="
|
||||||
|
alpine-mirror
|
||||||
|
alpine-mirror.conf
|
||||||
|
"
|
||||||
|
builddir="$srcdir"
|
||||||
|
options="!check" # wow nice tests
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -Dm755 alpine-mirror -t "$pkgdir"/etc/periodic/15min
|
||||||
|
install -Dm644 alpine-mirror.conf -t "$pkgdir"/etc
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="
|
||||||
|
60b46a766d0835dd8968b83b497eef520e555166cf6198189dce5231f321d22856339d0db5771ce63005e1e9e59d6ac8af5f6efa9ee2c027321a65e7e753b409 alpine-mirror
|
||||||
|
b7103fcd0411d64249f06c21a73fc87c290cbe60bb921515d319f6415b10e9c9d400d5a8b9b2816fc0f59f13f3df487fb88ec14fbaea2ff031c606b47540657b alpine-mirror.conf
|
||||||
|
"
|
39
alpine-mirror/alpine-mirror
Executable file
39
alpine-mirror/alpine-mirror
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# make sure we never run 2 rsync at the same time
|
||||||
|
lockfile="/tmp/alpine-mirror.lock"
|
||||||
|
if [ -z "$flock" ] ; then
|
||||||
|
exec env flock=1 flock -n $lockfile "$0" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# default config
|
||||||
|
src=rsync://rsync.alpinelinux.org/alpine/
|
||||||
|
dest=/var/lib/mirror/
|
||||||
|
versions="edge"
|
||||||
|
arches="x86_64"
|
||||||
|
|
||||||
|
. /etc/alpine-mirror.conf
|
||||||
|
|
||||||
|
mirror() {
|
||||||
|
mkdir -p "$dest$1"
|
||||||
|
echo "running rsync $1"
|
||||||
|
/usr/bin/rsync \
|
||||||
|
--archive \
|
||||||
|
--update \
|
||||||
|
--hard-links \
|
||||||
|
--delete \
|
||||||
|
--delete-after \
|
||||||
|
--delay-updates \
|
||||||
|
--timeout=600 \
|
||||||
|
"$src$1" "$dest$1"
|
||||||
|
exitcode=$?
|
||||||
|
[ $exitcode == 0 ] || echo "rsync $1 failed with exit code: $exitcode"
|
||||||
|
}
|
||||||
|
|
||||||
|
for version in $versions; do
|
||||||
|
for arch in $arches; do
|
||||||
|
mirror "$version/main/$arch/"
|
||||||
|
mirror "$version/community/$arch/"
|
||||||
|
[ "$version" = edge ] && mirror "$version/testing/$arch/"
|
||||||
|
done
|
||||||
|
done
|
6
alpine-mirror/alpine-mirror.conf
Normal file
6
alpine-mirror/alpine-mirror.conf
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# configuration for alpine-mirror
|
||||||
|
# replace these values to your liking
|
||||||
|
|
||||||
|
dest=/var/lib/mirror/
|
||||||
|
versions="edge"
|
||||||
|
arches="x86_64"
|
Loading…
Reference in a new issue