Skip to content

Commit 592c317

Browse files
authored
Cleanup opnsense images (#977)
Signed-off-by: Christian Berendt <berendt@osism.tech>
1 parent 20914e7 commit 592c317

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

contrib/mirror.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
import hashlib
34
import os
45
import patoolib
56
import requests
@@ -24,6 +25,9 @@
2425
def main(
2526
debug: bool = typer.Option(False, "--debug", help="Enable debug logging"),
2627
upload: bool = typer.Option(True, "--upload/--no-upload", help="Upload images"),
28+
checksum: bool = typer.Option(
29+
True, "--checksum/--no-checksum", help="Calculate and compare the checksum"
30+
),
2731
download: bool = typer.Option(
2832
True, "--download/--no-download", help="Download images"
2933
),
@@ -97,11 +101,12 @@ def main(
97101
"almalinux",
98102
"centos",
99103
"debian",
100-
"rocky",
101-
"ubuntu",
104+
"flatcar",
102105
"gardenlinux",
106+
"opnsense",
107+
"rocky",
103108
"talos",
104-
"flatcar",
109+
"ubuntu",
105110
)
106111
):
107112
continue
@@ -121,7 +126,9 @@ def main(
121126
)
122127
_, mirror_fileextension2 = os.path.splitext(mirror_filename)
123128

124-
if not image["shortname"].startswith(("gardenlinux", "talos", "flatcar")):
129+
if not image["shortname"].startswith(
130+
("gardenlinux", "talos", "flatcar", "opnsense")
131+
):
125132
mirror_filename = f"{version['version']}-{image['shortname']}"
126133

127134
if mirror_fileextension not in [".bz2", ".zip", ".xz", ".gz"]:
@@ -187,6 +194,15 @@ def main(
187194
)
188195
else:
189196
os.rename(source_filename, mirror_filename)
197+
198+
if checksum:
199+
h = hashlib.new("sha512")
200+
with open(mirror_filename, "rb") as fp:
201+
while c := fp.read(8192):
202+
h.update(c)
203+
204+
logger.info(f"SHA512 of {mirror_filename}: {h.hexdigest()}")
205+
190206
else:
191207
logger.info(
192208
f"Not downloading {source_filename} to local filesystem (download disabled)"

etc/images/opnsense.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@ images:
2626
provided_until: none
2727
tags: []
2828
versions:
29-
- version: '24.1'
30-
url: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/24.1/OPNsense-24.1-nano-amd64.img.bz2
31-
mirror_url: https://nbg1.your-objectstorage.com/osism/openstack-images/opnsense/24.1/OPNsense-24.1-nano-amd64.img
32-
checksum: "sha256:149641d45243bdbd7da3527408f31c3c4b02b5c6ca29b261b10c9af4236d11e7"
33-
build_date: 2024-01-29
34-
- version: '25.1'
35-
url: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/25.1/OPNsense-25.1-nano-amd64.img.bz2
36-
mirror_url: https://nbg1.your-objectstorage.com/osism/openstack-images/opnsense/25.1/OPNsense-25.1-nano-amd64.img
37-
checksum: "sha256:794a4d09846a974d0d041a0235ef29f54954e47843164912d46899016e0865a1"
38-
build_date: 2025-01-28
29+
- version: '25.7'
30+
url: https://mirror.ams1.nl.leaseweb.net/opnsense/releases/25.7/OPNsense-25.7-nano-amd64.img.bz2
31+
mirror_url: https://nbg1.your-objectstorage.com/osism/openstack-images/opnsense/25.7/OPNsense-25.7-nano-amd64
32+
checksum: "sha512:a337868f985c417740a414b298b597f964ab646610ad20eb856edd603e158f831d0c7f79229f6766614efddedd32c4bd373ee8968480ec8687431ddcfbbceff7"
33+
build_date: 2025-07-22

0 commit comments

Comments
 (0)