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.
 
 
 
 

168 lines
5.0 KiB

  1. #
  2. # Copyright 2018 John-Mark Gurney.
  3. # All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. # 1. Redistributions of source code must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. # 2. Redistributions in binary form must reproduce the above copyright
  11. # notice, this list of conditions and the following disclaimer in the
  12. # documentation and/or other materials provided with the distribution.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  15. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17. # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  18. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  20. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  21. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  22. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  23. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  24. # SUCH DAMAGE.
  25. #
  26. # $Id$
  27. #
  28. BEGIN {
  29. vmroot = "https://download.freebsd.org/ftp/snapshots/VM-IMAGES/"
  30. isoroot = "https://download.freebsd.org/ftp/snapshots/ISO-IMAGES/"
  31. relvmroot = "https://download.freebsd.org/ftp/releases/VM-IMAGES/"
  32. relisoroot = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/"
  33. }
  34. tolower($1) == "message-id:" {
  35. MID=$2
  36. sub(".*<", "", MID)
  37. sub(">.*", "", MID)
  38. }
  39. $0 == "== ISO CHECKSUMS ==" {
  40. type = "iso"
  41. }
  42. $0 == "== VM IMAGE CHECKSUMS ==" {
  43. type = "vm"
  44. }
  45. function isdate(date) {
  46. m = match(date, "[0-9]+")
  47. if (m && RLENGTH == 8)
  48. return 1
  49. return 0
  50. }
  51. #FreeBSD-13.0-CURRENT-powerpc-powerpcspe-20181026-r339752-bootonly.iso
  52. #FreeBSD-13.0-CURRENT-sparc64-20181026-r339752-bootonly.iso.asc
  53. #FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
  54. #FreeBSD-13.0-CURRENT-i386-20181026-r339752.vmdk.xz
  55. #FreeBSD-12.1-BETA3-amd64-mini-memstick.img.xz
  56. #FreeBSD-12.1-RC1-amd64-mini-memstick.img.xz
  57. $1 == "SHA512" {
  58. # Strip parens
  59. fname = substr($2, 2, length($2) - 2)
  60. split(fname, dotparts, ".")
  61. # recombine around dot in version, strips off ALL extensions (including vm type)
  62. basename = dotparts[1] "." dotparts[2]
  63. cnt = split(basename, parts, "-")
  64. # make arch part, may include additional part
  65. arch = parts[4]
  66. basearch = arch
  67. if (parts[4] == "arm" ||
  68. (parts[4] == "powerpc" && parts[5] == "powerpcspe") ||
  69. (parts[4] == "powerpc" && parts[5] == "powerpc64") ||
  70. parts[4] == "arm64") {
  71. # FreeBSD-11.3-STABLE-arm64-aarch64-20191011-r353406-memstick.img
  72. basearch = parts[5]
  73. arch = parts[4] "-" parts[5]
  74. nextidx = 6
  75. } else {
  76. # FreeBSD-11.3-STABLE-amd64-20191011-r353406.qcow2.xz
  77. nextidx = 5
  78. }
  79. # find date, may be platform first
  80. if (index(parts[3], "BETA") == 1 || index(parts[3], "RC") == 1) {
  81. if (nextidx > cnt) {
  82. # FreeBSD-12.1-BETA3-i386.vhd.xz
  83. platform = "xxx"
  84. } else if (cnt == nextidx) {
  85. # FreeBSD-12.1-RC1-powerpc-powerpcspe-dvd1.iso
  86. platform = parts[nextidx]
  87. nextidx += 1
  88. } else {
  89. # FreeBSD-12.1-BETA3-amd64-mini-memstick.img.xz
  90. platform = parts[nextidx] "-" parts[nextidx + 1]
  91. nextidx += 2
  92. }
  93. date = "xxx"
  94. } else if (isdate(parts[nextidx])) {
  95. # FreeBSD-11.3-STABLE-amd64-20191011-r353406.qcow2.xz
  96. platform = "xxx"
  97. date = parts[nextidx]
  98. nextidx += 1
  99. } else {
  100. # FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
  101. platform = parts[nextidx]
  102. date = parts[nextidx + 1]
  103. if (isdate(date)) {
  104. # FreeBSD-13.0-CURRENT-arm64-aarch64-PINEBOOK-20191011-r353427.img.xz
  105. nextidx += 2
  106. } else {
  107. # FreeBSD-13.0-CURRENT-arm64-aarch64-PINE64-LTS-20181026-r339752.img.xz
  108. date = parts[nextidx + 2]
  109. platform = parts[nextidx] "-" parts[nextidx + 1]
  110. nextidx += 3
  111. }
  112. }
  113. if (nextidx >= cnt)
  114. vers="xxx"
  115. else {
  116. vers=""
  117. sep=""
  118. for (i = nextidx + 1; i <= cnt; i++) {
  119. vers = vers sep parts[i]
  120. sep="-"
  121. }
  122. }
  123. if (index(parts[3], "BETA") == 1 || index(parts[3], "RC") == 1) {
  124. if (type == "vm") {
  125. vers = dotparts[3]
  126. url = relvmroot parts[2] "-" parts[3] "/" basearch "/Latest/" fname
  127. } else
  128. url = relisoroot parts[2] "/" fname
  129. } else {
  130. if (type == "vm") {
  131. vers = dotparts[3]
  132. url = vmroot parts[2] "-" parts[3] "/" basearch "/" date "/" fname
  133. } else
  134. url = isoroot parts[2] "/" fname
  135. }
  136. # if this part doesn't begin w/ r (for svn rev), skip it, we can't parse
  137. # others for now
  138. rev = parts[nextidx]
  139. if (index(parts[3], "BETA") == 1 || index(parts[3], "RC") == 1) {
  140. # FreeBSD-12.1-RC1-amd64-mini-memstick.img.xz
  141. rev = "unspec"
  142. } else if (substr(rev, 1, 1) != "r") {
  143. next
  144. }
  145. # double check that date is valid, if not, skip it
  146. if (date != "xxx" && !isdate(date))
  147. next
  148. printf("%s %s %s %s %s %s %s %s %s %s\n", type, parts[2] "-" parts[3], arch, platform, date, rev, vers, fname, url, MID)
  149. }