#!/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-2016 Fabian Affolter LATEST_RELEASE=3.4.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 $FILE mkdir -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/ ; do echo v$MAJOR.$MINOR/$i >> $FILE done ## Exclude folders inside the edge 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