A utility for downloading and verifying FreeBSD releases and snapshots
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

91 lines
2.0 KiB

  1. BEGIN {
  2. vmroot = "https://download.freebsd.org/ftp/snapshots/VM-IMAGES/"
  3. isoroot = "https://download.freebsd.org/ftp/snapshots/ISO-IMAGES/"
  4. }
  5. tolower($1) == "message-id:" {
  6. MID=$2
  7. sub(".*<", "", MID)
  8. sub(">.*", "", MID)
  9. }
  10. $0 == "== ISO CHECKSUMS ==" {
  11. root = isoroot
  12. type = "iso"
  13. }
  14. $0 == "== VM IMAGE CHECKSUMS ==" {
  15. root = vmroot
  16. type = "vm"
  17. }
  18. function isdate(date) {
  19. m = match(date, "[0-9]+")
  20. if (m && RLENGTH == 8)
  21. return 1
  22. return 0
  23. }
  24. #FreeBSD-13.0-CURRENT-powerpc-powerpcspe-20181026-r339752-bootonly.iso
  25. #FreeBSD-13.0-CURRENT-sparc64-20181026-r339752-bootonly.iso.asc
  26. #FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
  27. #FreeBSD-13.0-CURRENT-i386-20181026-r339752.vmdk.xz
  28. $1 == "SHA512" {
  29. # Strip parens
  30. fname = substr($2, 2, length($2) - 2)
  31. split(fname, dotparts, ".")
  32. # recombine around version string, strips of ALL extensions (including vm type)
  33. basename = dotparts[1] "." dotparts[2]
  34. cnt = split(basename, parts, "-")
  35. # make arch part, may include additional part
  36. arch = parts[4]
  37. basearch = arch
  38. if (parts[4] == "arm" || (parts[4] == "powerpc" && parts[5] == "powerpcspe") || parts[4] == "arm64") {
  39. basearch = parts[5]
  40. arch = parts[4] "-" parts[5]
  41. nextidx = 6
  42. } else
  43. nextidx = 5
  44. # find date, may be platform first
  45. if (isdate(parts[nextidx])) {
  46. platform = "xxx"
  47. date = parts[nextidx]
  48. nextidx += 1
  49. } else {
  50. platform = parts[nextidx]
  51. date = parts[nextidx + 1]
  52. if (isdate(date)) {
  53. nextidx += 2
  54. } else {
  55. date = parts[nextidx + 2]
  56. platform = parts[nextidx] "-" parts[nextidx + 1]
  57. nextidx += 3
  58. }
  59. }
  60. if (nextidx == cnt)
  61. vers="xxx"
  62. else {
  63. vers=""
  64. sep=""
  65. for (i = nextidx + 1; i <= cnt; i++) {
  66. vers = vers sep parts[i]
  67. sep="-"
  68. }
  69. }
  70. if (type == "vm") {
  71. vers = dotparts[3]
  72. url = root parts[2] "-" parts[3] "/" basearch "/" date "/" fname
  73. } else
  74. url = root parts[2] "/" fname
  75. printf("%s %s %s %s %s %s %s %s %s %s\n", type, parts[2] "-" parts[3], arch, platform, date, parts[nextidx], vers, fname, url, MID)
  76. }