Erich Eckner <arch@eckner.net> on Fri, 2021/05/28 14:26:
Well, out-of-date is a term that does barely match here... pacman does known about the date of its current database files only. So yes, more recent database files are used as long as they are newer than the local ones - even if out-of-date compared with a mirror.
That's why the pacredir documentation tells you to run `pacman -Sy` twice to be sure: First run fetches the newest database from local network, second run (where pacredir returns 404) fetches from mirror if a newer version is available.
Just some side-idea: why not consider all databases which are older than x minutes (where x is configurable) "out of date"? This would rely on having systemtimes in sync, but otherwise would get rid of the cumbersome double-`pacman -Syu`.
Great idea... About to add that. :)
P.S.: I'm running something similar as you - but by far not as elaborate: two (for redundancy) nginx servers which cache packages and download databases directly.
Try pacredir for an out-of-the-box solution. ;) BTW, if my solution with server side headers is accepted... In nginx configuration your location block could look something like this: location / { root /var/cache/pacman/pkg/ add_header X-Pacman-Expected-Failure true; } -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}