Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - kronenpj

#1
General Discussion / Re: Setting up OPNsense mirror
September 17, 2023, 05:19:31 PM
Thanks for starting this thread! My contribution is a slightly more flexible script which only mirrors the latest versions, e.g. FreeBSD:13:amd64/23.7, but all the patch levels underneath. It also doesn't clean up older copies.  Adding --delete-after --delete-excluded to the rsync command would take care of that auto-magically. Of course, change the values of MIRROR and LOCAL_MIRROR for your situation. I'm running this once per week in cron.


#!/usr/bin/env bash

MIRROR="mirror.wdc1.us.leaseweb.net"
LOCAL_MIRROR="/export/home2/mirror"
REPOPATH="opnsense"

# Determine latest major FreeBSD release offered
RELEASE=$(rsync rsync://${MIRROR}/${REPOPATH}/ |& \
grep FreeBSD | grep amd64 | tail -1 | awk '{print $5}')
REPOPATH="${REPOPATH}/$RELEASE"

# Determine latest opnsense release offered
REV=$(rsync rsync://${MIRROR}/${REPOPATH}/ |& \
grep -v snapshots | tail -1 | awk '{print $5}')

# Retrieve the repository, using as much local information as is available (-y)
rsync --archive -Py \
--exclude=LibreSSL \
--exclude=libressl \
--hard-links \
--numeric-ids \
--stats \
rsync://${MIRROR}/${REPOPATH}/$REV ${LOCAL_MIRROR}/${REPOPATH}