summaryrefslogtreecommitdiff
path: root/mirror-portage.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mirror-portage.sh')
-rw-r--r--mirror-portage.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/mirror-portage.sh b/mirror-portage.sh
new file mode 100644
index 0000000..57a6190
--- /dev/null
+++ b/mirror-portage.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# sync-portage.sh – wrapper for Gentoo Portage rsync mirror
+#
+
+RSYNC_OPTS="-avH --partial --delete --delete-delay \
+ --safe-links --hard-links --numeric-ids \
+ --timeout=300 --contimeout=60 --info=progress2"
+
+TARGET="/brimstone1a/mirror/gentoo/portage"
+SOURCE="rsync://masterportage.gentoo.org"
+
+LOGFILE="/var/log/portage-sync.log"
+STATUSFILE="/var/www/mirror-status/portage.lastsync"
+
+# Run rsync and log output
+rsync $RSYNC_OPTS "$SOURCE" "$TARGET" >> "$LOGFILE" 2>&1
+RC=$?
+
+# If rsync succeeded, update freshness marker
+if [ $RC -eq 0 ]; then
+ date -u +%s > "$STATUSFILE"
+ echo "$(date -u) : sync OK" >> "$LOGFILE"
+else
+ echo "$(date -u) : sync FAILED with code $RC" >> "$LOGFILE"
+fi
+
+exit $RC