Mirror getdeb

From Skytech
Jump to navigation Jump to search

Mirror - getdeb

#/bin/sh

fatal() {
  echo "$1"
  exit 1
}

warn() {
  echo "$1"
}

# RSYNC source
RSYNCSOURCE=rsync://rsync.getdeb.net/getdeb/

# Define where you want the mirror-data to be on your mirror
BASEDIR=$HOME/getdeb

if [ ! -d ${BASEDIR} ]; then
  warn "${BASEDIR} does not exist yet, trying to create it..."
  mkdir -p ${BASEDIR} || fatal "Creation of ${BASEDIR} failed."
fi

rsync --recursive --times --links --hard-links \
  --stats \
  --exclude "Packages*" --exclude "Sources*" \
  --exclude "Release*" \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed."

rsync --recursive --times --links --hard-links \
  --stats --delete --delete-after \
  ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed."