Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions contrib/mirror.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

import hashlib
import os
import patoolib
import requests
Expand All @@ -24,6 +25,9 @@
def main(
debug: bool = typer.Option(False, "--debug", help="Enable debug logging"),
upload: bool = typer.Option(True, "--upload/--no-upload", help="Upload images"),
checksum: bool = typer.Option(
True, "--checksum/--no-checksum", help="Calculate and compare the checksum"
),
download: bool = typer.Option(
True, "--download/--no-download", help="Download images"
),
Expand Down Expand Up @@ -97,11 +101,12 @@ def main(
"almalinux",
"centos",
"debian",
"rocky",
"ubuntu",
"flatcar",
"gardenlinux",
"opnsense",
"rocky",
"talos",
"flatcar",
"ubuntu",
)
):
continue
Expand All @@ -121,7 +126,9 @@ def main(
)
_, mirror_fileextension2 = os.path.splitext(mirror_filename)

if not image["shortname"].startswith(("gardenlinux", "talos", "flatcar")):
if not image["shortname"].startswith(
("gardenlinux", "talos", "flatcar", "opnsense")
):
mirror_filename = f"{version['version']}-{image['shortname']}"

if mirror_fileextension not in [".bz2", ".zip", ".xz", ".gz"]:
Expand Down Expand Up @@ -187,6 +194,15 @@ def main(
)
else:
os.rename(source_filename, mirror_filename)

if checksum:
h = hashlib.new("sha512")
with open(mirror_filename, "rb") as fp:
while c := fp.read(8192):
h.update(c)

logger.info(f"SHA512 of {mirror_filename}: {h.hexdigest()}")

else:
logger.info(
f"Not downloading {source_filename} to local filesystem (download disabled)"
Expand Down
15 changes: 5 additions & 10 deletions etc/images/opnsense.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ images:
provided_until: none
tags: []
versions:
- version: '24.1'
url: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/24.1/OPNsense-24.1-nano-amd64.img.bz2
mirror_url: https://nbg1.your-objectstorage.com/osism/openstack-images/opnsense/24.1/OPNsense-24.1-nano-amd64.img
checksum: "sha256:149641d45243bdbd7da3527408f31c3c4b02b5c6ca29b261b10c9af4236d11e7"
build_date: 2024-01-29
- version: '25.1'
url: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/25.1/OPNsense-25.1-nano-amd64.img.bz2
mirror_url: https://nbg1.your-objectstorage.com/osism/openstack-images/opnsense/25.1/OPNsense-25.1-nano-amd64.img
checksum: "sha256:794a4d09846a974d0d041a0235ef29f54954e47843164912d46899016e0865a1"
build_date: 2025-01-28
- version: '25.7'
url: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/25.7/OPNsense-25.7-nano-amd64.img.bz2
mirror_url: https://nbg1.your-objectstorage.com/osism/openstack-images/opnsense/25.7/OPNsense-25.7-nano-amd64
checksum: "sha512:a337868f985c417740a414b298b597f964ab646610ad20eb856edd603e158f831d0c7f79229f6766614efddedd32c4bd373ee8968480ec8687431ddcfbbceff7"
build_date: 2025-07-22