![]() |
|
|||
![]()
A simple shell script to locate an OpenBSD https mirror with the latest snapshot.
The script retrieves the BUILDINFO file from several mirrors and sorts these on the Unix timestamp (number of seconds since 1970) which is the third word or key. An example BUILDINFO: Code:
Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 Code:
$ date -r 1617495973 Sun Apr 4 02:26:13 CEST 2021 Code:
$ env TZ=UTC date -r 1617495973 Sun Apr 4 00:26:13 UTC 2021 Code:
$ ./getBUILDINFO.sh ./getBUILDINFO.sh: /home/snap2/tmp directory cleared .... --- Alberta ----------- Trying 129.128.5.191... Requesting https://ftp.openbsd.org/pub/OpenBSD/snapshots/amd64/BUILDINFO 100% |*********************************************| 54 00:00 54 bytes received in 0.00 seconds (70.62 KB/s) [snip] --- Cloudfare ----------- Trying 104.17.249.92... Requesting https://cloudflare.cdn.openbsd.org/pub/OpenBSD/snapshots/amd64/BUILDINFO 100% |*********************************************| 54 00:00 54 bytes received in 0.00 seconds (70.61 KB/s) Sun 4-Apr-2021 06:19 CEST +0200 = Sun 4-Apr-2021 04:19 UTC Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Aachen Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Ede Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Nluug Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 - Alberta Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 - Cloudfare Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 - Copenhagen Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 - Stockholm Code:
Build date: 1617392997 - Fri Apr 2 19:49:57 UTC 2021 - Nluug Build date: 1617436633 - Sat Apr 3 07:57:13 UTC 2021 - Aachen Build date: 1617436633 - Sat Apr 3 07:57:13 UTC 2021 - Ede Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Alberta Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Cloudfare Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Copenhagen Build date: 1617469416 - Sat Apr 3 17:03:36 UTC 2021 - Stockholm Code:
#/bin/sh # (c) 2021 j65nko daemonforums.org # OpenBSD License: https://cvsweb.openbsd.org/src/share/misc/license.template?rev=HEAD ARCH=amd64 DIR=snapshots/$ARCH # --- Directory STORAGE will be emptied! STORAGE=~/tmp mkdir -p ~/tmp # --- https/ftp sites from openbsd.org/ftp.html Alberta=https://ftp.openbsd.org/pub/OpenBSD Stockholm=https://ftp.eu.openbsd.org/pub/OpenBSD Nluug=https://ftp.nluug.nl/OpenBSD Ede=https://ftp.bit.nl/pub/OpenBSD Copenhagen=https://mirror.one.com/pub/OpenBSD Aachen=https://ftp.halifax.rwth-aachen.de/pub/OpenBSD Cloudfare=https://cloudflare.cdn.openbsd.org/pub/OpenBSD rm $STORAGE/{BUILDINFO_,tmp_}* && echo $0: $STORAGE directory cleared .... for site in Alberta Stockholm Nluug Ede Copenhagen Aachen Cloudfare; do eval SITE=\${$site} echo ; echo --- $site ----------- ftp -4 -o $STORAGE/tmp_$site $SITE/$DIR/BUILDINFO sed -e "s/$/ - $site/" $STORAGE/tmp_$site >$STORAGE/BUILDINFO_$site done echo echo $(date "+%a %v %R %Z %z") = $(env TZ=UTC date "+%a %v %R %Z") echo cat $STORAGE/BUILDINFO_* | sort -k3 # ---- Code:
ls -l ; cat tmp_Alberta BUILDINFO_Alberta -rw-r--r-- 1 snap2 snap2 63 Apr 4 06:19 BUILDINFO_Aachen -rw-r--r-- 1 snap2 snap2 64 Apr 4 06:19 BUILDINFO_Alberta -rw-r--r-- 1 snap2 snap2 66 Apr 4 06:19 BUILDINFO_Cloudfare -rw-r--r-- 1 snap2 snap2 67 Apr 4 06:19 BUILDINFO_Copenhagen -rw-r--r-- 1 snap2 snap2 60 Apr 4 06:19 BUILDINFO_Ede -rw-r--r-- 1 snap2 snap2 62 Apr 4 06:19 BUILDINFO_Nluug -rw-r--r-- 1 snap2 snap2 66 Apr 4 06:19 BUILDINFO_Stockholm -rw-r--r-- 1 snap2 snap2 54 Apr 3 19:03 tmp_Aachen -rw-r--r-- 1 snap2 snap2 54 Apr 4 02:26 tmp_Alberta -rw-r--r-- 1 snap2 snap2 54 Apr 4 02:26 tmp_Cloudfare -rw-r--r-- 1 snap2 snap2 54 Apr 4 02:26 tmp_Copenhagen -rw-r--r-- 1 snap2 snap2 54 Apr 3 19:03 tmp_Ede -rw-r--r-- 1 snap2 snap2 54 Apr 3 19:03 tmp_Nluug -rw-r--r-- 1 snap2 snap2 54 Apr 4 02:26 tmp_Stockholm Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 Build date: 1617495973 - Sun Apr 4 00:26:13 UTC 2021 - Alberta $ sort -k3 to produce the output.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 4th April 2021 at 05:21 AM. |
|
|||
![]()
The script for downloading.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]()
@jggimi
In my Tracking OpenBSD snapshots with some simple shell scripts guide from December 2009, I posted another approach that included the snapshot packages. You must have missed that one ![]() Being built on ftp and the ftp-only .netrc file, those scripts stopped working when the main Alberta site switched from ftp to http-only server. Because of the emergence of the BUILDINFO file and the inclusion of index.txt files, the process of snapshot tracking can be simplified enormously compared with what I posted in Dec 2009. I am working on it ...... ![]()
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
![]() |
Tags |
openbsd snapshots, snapshots |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD 5.5 snapshot/Gnome 3.10.2 config issues | JWJones | OpenBSD Packages and Ports | 8 | 18th March 2014 11:50 AM |
OpenBSD i386 snapshot & PAE on VirtualBox | aleunix | OpenBSD Installation and Upgrading | 2 | 1st March 2012 06:44 PM |
Apached checking its own status? | Mantazz | FreeBSD Ports and Packages | 5 | 4th August 2010 04:11 AM |
Automating OpenBSD snapshot downloads with a .netrc file | J65nko | Guides | 1 | 7th January 2010 03:09 AM |
Status of Xen on OpenBSD | Oko | OpenBSD General | 2 | 19th June 2008 09:02 PM |