summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Affolter <fabian@affolter-engineering.ch>2012-01-03 16:56:07 +0000
committerFabian Affolter <fabian@affolter-engineering.ch>2012-01-03 16:56:07 +0000
commit5d604a7e9df8b5eb036bb8914664ce681f660111 (patch)
treed693716d540a2cd5c583aed61a79b613349c86f9
parentaf059a37feeda98f6287998720780cd05ab6b220 (diff)
downloadscripts-5d604a7e9df8b5eb036bb8914664ce681f660111.tar.bz2
scripts-5d604a7e9df8b5eb036bb8914664ce681f660111.tar.xz
Initial commit
alpine-mirror is a simple script to sync a mirror of Alpine Linux.
-rw-r--r--alpine-mirror.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/alpine-mirror.sh b/alpine-mirror.sh
new file mode 100644
index 0000000..2050c88
--- /dev/null
+++ b/alpine-mirror.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# This simple script is setting up a Alpine Linux installation in a chroot.
+# chroot will be placed in the current working directory.
+#
+# This script can be used to setup a Alpine Linux mirror.
+# http://wiki.alpinelinux.org/wiki/How_to_setup_a_Alpine_Linux_mirror
+#
+# Licensed under GPLv2
+#
+# Copyright (c) 2011 Fabian Affolter <fabian at affolter-engineering.ch>
+
+
+LATEST_RELEASE=2.3
+MAJOR=${LATEST_RELEASE%.*}
+MINOR=${LATEST_RELEASE#*.}
+FILE=excl-al.txt
+SRC=rsync://rsync.alpinelinux.org/alpine/
+DEST=/data01/mirror/alpine/
+
+## Delete the old exclusion file
+rm $FILEmkdir -p $DEST
+
+## 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 "$@"
+
+## Exclude the v1.x releases
+for ((i=1; i<=10; i++)); do
+ echo v1.$i/ >> $FILE
+done
+## Exclude all former releases
+for ((i=0; i<=$MINOR-1; i++)); do
+ echo v$MAJOR.$i/ >> $FILE
+done
+## Exclude folders inside the current release tree
+for i in releases/ main/x86/ testing/x86/ ; do
+ echo v$MAJOR.$MINOR/$i >> $FILE
+done
+## Exclude folders inside the current release tree
+for i in releases/ main/x86/ testing/x86/ ; do
+ echo edge/$i >> $FILE
+done
+
+## Syncing content
+/usr/bin/rsync \
+--archive \
+--verbose \
+--stats \
+--partial \
+--progress \
+--exclude-from=$FILE \
+$SRC \
+$DEST