Commit 7c936f49 authored by Seblu's avatar Seblu
Browse files

Use one rsync server for repo and iso

Manage sync of repo and iso from the same rsync server
parent 997a4695
Loading
Loading
Loading
Loading
+6 −21
Original line number Diff line number Diff line
# vim:set sw=2 ts=2 ft=sh et:

# Archive base directory
# Archlinux remote rsync server
ARCHIVE_RSYNC='rsync://polymorf.fr/archlinux/'

# Archive local directory
ARCHIVE_DIR='/srv/archive'

# Package extensions
@@ -14,12 +17,6 @@ PKGSIG="$PKGEXT.sig"
# Enable repositories archiving
ARCHIVE_REPO=1

# Repositories source
REPO_RSYNC='rsync://polymorf.fr/archlinux/'

# Local repositories snapshot tree
REPO_DIR="$ARCHIVE_DIR/repos"

# Enable daily repo trees
# This offer daily, weekly, monthly, yearly snapshot trees
REPO_DAYLY=1
@@ -36,21 +33,12 @@ REPO_PACKAGES_INDEX=1
# Better option is to let it to 0 to look only in the last snapshot
REPO_PACKAGES_FULL_SEARCH=0

# Local repositories snapshot tree
PACKAGES_DIR="$ARCHIVE_DIR/packages"

##############################################################################
#### ISO
##############################################################################

# Enable ISO archiving
ARCHIVE_ISO=0

# ISO files origin
ISO_RSYNC='rsync://polymorf.fr/archlinux/iso/'

# Local ISO tree
ISO_DIR="$ARCHIVE_DIR/iso"
ARCHIVE_ISO=1

##############################################################################
#### AUR
@@ -59,8 +47,5 @@ ISO_DIR="$ARCHIVE_DIR/iso"
# Enale AUR archiving
ARCHIVE_AUR=0

# AUR tree origin
# AUR Rsync Tree
AUR_RSYNC='rsync://aur.archlinux.org/unsupported/'

# Local AUR tree
AUR_DIR="$ARCHIVE_DIR/aur"
+11 −2
Original line number Diff line number Diff line
@@ -64,8 +64,8 @@ repo_rsync() {
	msg2 'Rsyncing...'
	# rsync from master using last sync
	# we must use absolute path with --link-dest to avoid errors
	rsync  -rltH $LINKDEST --exclude '*/.*' "$REPO_RSYNC" "$SNAP/" ||
		fail "Unable to rsync: $REPO_RSYNC"
	rsync  -rltH $LINKDEST --exclude '*/.*' --exclude 'iso/*' "$ARCHIVE_RSYNC" "$SNAP/" ||
		fail "Unable to rsync: $ARCHIVE_RSYNC"

	# only to have a quick check of sync in listdir
	touch "$SNAP"
@@ -92,6 +92,7 @@ repo_daily() {
# update the packages tree with packages in snapshoted repositories
repo_packages() {
	msg "Updating package tree"
	local PACKAGES_DIR="$ARCHIVE_DIR/packages"
	local PKGFLAT="$PACKAGES_DIR/.all" #must be subdirectory of $PACKAGES_DIR
	local SCANDIR filename pkgname first parent tdst fdst

@@ -172,6 +173,9 @@ repo_packages_index() {
iso_rsync() {
	msg "Rsyncing ISO"

	local ISO_RSYNC="$ARCHIVE_RSYNC/iso/"
	local ISO_DIR="$ARCHIVE_DIR/iso"

	# ensure destination exists
	[[ -d "$ISO_DIR" ]] || mkdir -p "$ISO_DIR"

@@ -183,6 +187,7 @@ iso_rsync() {
aur_rsync() {
	msg "Snapshoting AUR"

	local AUR_DIR="$ARCHIVE_DIR/aur"
	local SNAPR="$(date +%Y/%m/%d)"
	local SNAP="$AUR_DIR/$SNAPR"

@@ -228,6 +233,8 @@ main() {
	umask 022

	if (( $ARCHIVE_REPO )); then
		REPO_DIR="$ARCHIVE_DIR/repos"

		repo_rsync

		(( $REPO_DAYLY )) && repo_daily
@@ -238,6 +245,8 @@ main() {
	(( $ARCHIVE_ISO)) && iso_rsync

	(( $ARCHIVE_AUR)) && aur_rsync

	return 0
}

main "$@"