contrib: create a shared directory for iana information

This commit is contained in:
Franco Fichtner 2025-05-13 10:52:23 +02:00
parent b7527ced15
commit aaa9e49fd0
8 changed files with 28 additions and 30 deletions

View file

@ -1,4 +1,4 @@
ROOT= /usr/local/opnsense/contrib
TREES= base32 IXR mobile-broadband-provider-info tzdata
TREES= base32 iana IXR mobile-broadband-provider-info
.include "../Mk/core.mk"

4
plist
View file

@ -162,9 +162,9 @@
/usr/local/libexec/opnsense-auth
/usr/local/opnsense/contrib/IXR/IXR_Library.php
/usr/local/opnsense/contrib/base32/Base32.php
/usr/local/opnsense/contrib/iana/tzdata-iso3166.tab
/usr/local/opnsense/contrib/iana/tzdata-zone.tab
/usr/local/opnsense/contrib/mobile-broadband-provider-info/serviceproviders.xml
/usr/local/opnsense/contrib/tzdata/iso3166.tab
/usr/local/opnsense/contrib/tzdata/zone.tab
/usr/local/opnsense/data/firmware/upgrade.html
/usr/local/opnsense/data/unbound/root.min.hints
/usr/local/opnsense/mvc/app/cache/README

View file

@ -1,31 +1,29 @@
<?php
/**
* Copyright (C) 2018 Deciso B.V.
/*
* Copyright (C) 2018 Deciso B.V.
* All rights reserved.
*
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Firewall\Api;
@ -258,7 +256,7 @@ class AliasController extends ApiMutableModelControllerBase
];
$contribDir = (new AppConfig())->application->contribDir;
foreach (explode("\n", file_get_contents($contribDir . '/tzdata/iso3166.tab')) as $line) {
foreach (explode("\n", file_get_contents($contribDir . '/iana/tzdata-iso3166.tab')) as $line) {
$line = trim($line);
if (strlen($line) > 3 && substr($line, 0, 1) != '#') {
$result[substr($line, 0, 2)] = array(
@ -267,7 +265,7 @@ class AliasController extends ApiMutableModelControllerBase
);
}
}
foreach (explode("\n", file_get_contents($contribDir . '/tzdata/zone.tab')) as $line) {
foreach (explode("\n", file_get_contents($contribDir . '/iana/tzdata-zone.tab')) as $line) {
if (strlen($line) > 0 && substr($line, 0, 1) == '#') {
continue;
}

View file

@ -65,7 +65,7 @@ class CountryField extends BaseListField
}
if (empty(self::$internalCacheOptionList[$setid])) {
$contribDir = (new AppConfig())->application->contribDir;
$filename = $contribDir . '/tzdata/iso3166.tab';
$filename = $contribDir . '/iana/tzdata-iso3166.tab';
$data = file_get_contents($filename);
foreach (explode("\n", $data) as $line) {
$line = trim($line);

View file

@ -107,7 +107,7 @@ class AliasContentField extends BaseField
// Maxmind's country code 6255148 (EU Unclassified)
self::$internalCountryCodes[] = 'EU';
$contribDir = (new AppConfig())->application->contribDir;
foreach (explode("\n", file_get_contents($contribDir . '/tzdata/iso3166.tab')) as $line) {
foreach (explode("\n", file_get_contents($contribDir . '/iana/tzdata-iso3166.tab')) as $line) {
$line = trim($line);
if (strlen($line) > 3 && substr($line, 0, 1) != '#') {
self::$internalCountryCodes[] = substr($line, 0, 2);

View file

@ -43,7 +43,7 @@ function get_country_codes()
$dn_cc = [];
$iso3166_tab = $contribDir . '/tzdata/iso3166.tab';
$iso3166_tab = $contribDir . '/iana/tzdata-iso3166.tab';
if (file_exists($iso3166_tab)) {
$dn_cc_file = file($iso3166_tab);
foreach ($dn_cc_file as $line) {