// "[o.o]"



Since i now have a pkgbase mirror, i thought i'd go for a pkg mirror aswell. I had something similar when i ran Gentoo Linux servers. If you tinker around, have a few Virtual Machines, some jails and some servers. It adds up when it's time to update or reinstall. Even though it's peanuts for the mirrors, it still feels wasteful. You also learn something, if you do it locally.

First thought was to do it like a real mirror, and maby rsync from the server, once a week (like i did on Gentoo) via a cron script. Then update clients after that. Saw that about 1.5TB was needed. Might do that later, but for now, i saw through the documentation that
you could create a pkg cache instead, which seams more reasonable at first.

Created a new entry in /usr/local/etc/nginx/nginx.conf
location /pkgcache {
root /var/tmp/pkgcache/;
index index.html index.htm;
}
Then i create that folder and in that a file called list which contains all packages i use frequently. Lets say i have like 500ish packages i need from the 36000+ it makes sense I add a script to sync my pkgs:
pkglist=`cat /var/tmp/pkgcache/list`
doas pkg fetch -y -d -o /var/tmp/pkgcache $pkglist
doas pkg repo /var/tmp/pkgcache

I then add an entry to cron: 37 13 * * 2 root /var/tmp/pkgcache/pkgsync.sh
On the clients i add this Freebsd-cache.conf into /usr/local/etc/pkg/repos/
FreeBSD-cache: {
url: "http://192.168.0.31/pkgcache",
priority: 100, # prioritize this over regular pkg repo
enabled: yes
}

doas pkg update from client as usual

Short and sweet