mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
system: always rewrite from the default file
As an added benefit, (default) will now always revert back to the actual default from the sample configuration, which is exactly how it should be.
This commit is contained in:
parent
682613324c
commit
4977452594
@ -1,2 +0,0 @@
|
||||
echo "Removing previous package configuration"
|
||||
rm -f /usr/local/etc/pkg/repos/origin.conf
|
||||
2
Makefile
2
Makefile
@ -139,7 +139,7 @@ depends: force
|
||||
|
||||
scripts: force
|
||||
@mkdir -p ${DESTDIR}
|
||||
@cp -v -- +PRE_DEINSTALL +PRE_INSTALL +POST_INSTALL ${DESTDIR}
|
||||
@cp -v -- +PRE_DEINSTALL +POST_INSTALL ${DESTDIR}
|
||||
@sed -i '' -e "s/%%CORE_COMMIT%%/${CORE_COMMIT}/g" \
|
||||
${DESTDIR}/+POST_INSTALL
|
||||
|
||||
|
||||
@ -187,6 +187,34 @@ function get_country_codes()
|
||||
return $dn_cc;
|
||||
}
|
||||
|
||||
function get_firmware_mirrors()
|
||||
{
|
||||
$mirrors = array();
|
||||
|
||||
$mirrors['default'] = '(default)';
|
||||
$mirrors['https://opnsense.c0urier.net'] = 'c0urier.net (Lund, SE)';
|
||||
$mirrors['https://fleximus.org/mirror/opnsense'] = 'Fleximus (Roubaix, FR)';
|
||||
$mirrors['http://mirror.ams1.nl.leaseweb.net/opnsense'] = 'LeaseWeb (Amsterdam, NL)';
|
||||
$mirrors['http://mirror.fra10.de.leaseweb.net/opnsense'] = 'LeaseWeb (Frankfurt, DE)';
|
||||
$mirrors['http://mirror.sfo12.us.leaseweb.net/opnsense'] = 'LeaseWeb (San Francisco, US)';
|
||||
$mirrors['http://mirror.wdc1.us.leaseweb.net/opnsense'] = 'LeaseWeb (Washington, D.C., US)';
|
||||
$mirrors['http://mirrors.nycbug.org/pub/opnsense'] = 'NYC*BUG (New York, US)';
|
||||
$mirrors['http://pkg.opnsense.org'] = 'OPNsense (Amsterdam, NL)';
|
||||
|
||||
return $mirrors;
|
||||
}
|
||||
|
||||
function get_firmware_flavours()
|
||||
{
|
||||
$flavours = array();
|
||||
|
||||
$flavours['default'] = '(default)';
|
||||
$flavours['libressl'] = 'LibreSSL';
|
||||
$flavours['latest'] = 'OpenSSL';
|
||||
|
||||
return $flavours;
|
||||
}
|
||||
|
||||
function get_zoneinfo()
|
||||
{
|
||||
return timezone_identifiers_list(DateTimeZone::ALL ^ DateTimeZone::UTC);
|
||||
@ -1297,6 +1325,31 @@ EOD;
|
||||
|
||||
}
|
||||
|
||||
function system_firmware_configure()
|
||||
{
|
||||
global $config;
|
||||
|
||||
/* rewrite the config via the defaults */
|
||||
$origin_conf = '/usr/local/etc/pkg/repos/origin.conf';
|
||||
copy("${origin_conf}.sample", $origin_conf);
|
||||
|
||||
if (isset($config['system']['firmware']['mirror'])) {
|
||||
/* XXX create a proper backend call */
|
||||
mwexecf(
|
||||
'/usr/local/sbin/opnsense-update -sm %s',
|
||||
str_replace('/', '\/', $config['system']['firmware']['mirror'])
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($config['system']['firmware']['flavour'])) {
|
||||
/* XXX create a proper backend call */
|
||||
mwexecf(
|
||||
'/usr/local/sbin/opnsense-update -sn %s',
|
||||
str_replace('/', '\/', $config['system']['firmware']['flavour'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function system_timezone_configure()
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -196,6 +196,9 @@ load_thermal_hardware();
|
||||
/* set up our timezone */
|
||||
system_timezone_configure();
|
||||
|
||||
/* set up firmware configuration */
|
||||
system_firmware_configure();
|
||||
|
||||
/* set up our hostname */
|
||||
system_hostname_configure();
|
||||
|
||||
|
||||
@ -39,57 +39,25 @@ require_once("pfsense-utils.inc");
|
||||
require_once("services.inc");
|
||||
require_once("unbound.inc");
|
||||
|
||||
/****f* legacy/reload_all_sync
|
||||
* NAME
|
||||
* reload_all - reload all settings
|
||||
* * INPUTS
|
||||
* none
|
||||
* RESULT
|
||||
* none
|
||||
******/
|
||||
function reload_all_sync()
|
||||
{
|
||||
global $config;
|
||||
|
||||
/* parse config.xml again */
|
||||
$config = parse_config();
|
||||
|
||||
/* set up our timezone */
|
||||
system_timezone_configure();
|
||||
|
||||
/* set up our hostname */
|
||||
system_hostname_configure();
|
||||
|
||||
/* make hosts file */
|
||||
system_hosts_generate();
|
||||
|
||||
/* generate resolv.conf */
|
||||
system_resolvconf_generate();
|
||||
|
||||
/* enable routing */
|
||||
system_routing_enable();
|
||||
|
||||
/* set up interfaces */
|
||||
interfaces_configure();
|
||||
|
||||
/* start dyndns service */
|
||||
services_dyndns_configure();
|
||||
|
||||
/* configure cron service */
|
||||
configure_cron();
|
||||
|
||||
/* start the NTP client */
|
||||
system_ntp_configure();
|
||||
|
||||
/* restart sshd */
|
||||
mwexec_bg('/usr/local/etc/rc.sshd');
|
||||
|
||||
/* restart webConfigurator if needed */
|
||||
mwexec_bg('/usr/local/etc/rc.restart_webgui');
|
||||
}
|
||||
global $config;
|
||||
|
||||
$config = parse_config();
|
||||
|
||||
log_error("rc.reload_all: Reloading all configuration settings.");
|
||||
reload_all_sync();
|
||||
|
||||
system_timezone_configure();
|
||||
system_firmware_configure();
|
||||
system_hostname_configure();
|
||||
system_hosts_generate();
|
||||
system_resolvconf_generate();
|
||||
system_routing_enable();
|
||||
interfaces_configure();
|
||||
services_dyndns_configure();
|
||||
configure_cron();
|
||||
system_ntp_configure();
|
||||
mwexec_bg('/usr/local/etc/rc.sshd');
|
||||
mwexec_bg('/usr/local/etc/rc.restart_webgui');
|
||||
|
||||
log_error("rc.reload_all: Reloading filter configuration.");
|
||||
|
||||
filter_configure_sync();
|
||||
|
||||
@ -50,34 +50,6 @@ function get_locale_list()
|
||||
return $locales;
|
||||
}
|
||||
|
||||
function get_firmware_mirrors()
|
||||
{
|
||||
$mirrors = array();
|
||||
|
||||
$mirrors['default'] = '(default)';
|
||||
$mirrors['https://opnsense.c0urier.net'] = 'c0urier.net (Lund, SE)';
|
||||
$mirrors['https://fleximus.org/mirror/opnsense'] = 'Fleximus (Roubaix, FR)';
|
||||
$mirrors['http://mirror.ams1.nl.leaseweb.net/opnsense'] = 'LeaseWeb (Amsterdam, NL)';
|
||||
$mirrors['http://mirror.fra10.de.leaseweb.net/opnsense'] = 'LeaseWeb (Frankfurt, DE)';
|
||||
$mirrors['http://mirror.sfo12.us.leaseweb.net/opnsense'] = 'LeaseWeb (San Francisco, US)';
|
||||
$mirrors['http://mirror.wdc1.us.leaseweb.net/opnsense'] = 'LeaseWeb (Washington, D.C., US)';
|
||||
$mirrors['http://mirrors.nycbug.org/pub/opnsense'] = 'NYC*BUG (New York, US)';
|
||||
$mirrors['http://pkg.opnsense.org'] = 'OPNsense (Amsterdam, NL)';
|
||||
|
||||
return $mirrors;
|
||||
}
|
||||
|
||||
function get_firmware_flavours()
|
||||
{
|
||||
$flavours = array();
|
||||
|
||||
$flavours['default'] = '(default)';
|
||||
$flavours['libressl'] = 'LibreSSL';
|
||||
$flavours['latest'] = 'OpenSSL';
|
||||
|
||||
return $flavours;
|
||||
}
|
||||
|
||||
$pconfig['hostname'] = $config['system']['hostname'];
|
||||
$pconfig['domain'] = $config['system']['domain'];
|
||||
if (isset($config['system']['dnsserver'])) {
|
||||
@ -253,16 +225,12 @@ if ($_POST) {
|
||||
/* default does not set anything for backwards compat */
|
||||
unset($config['system']['firmware']['mirror']);
|
||||
} else {
|
||||
/* XXX create a proper backend call */
|
||||
mwexecf('/usr/local/sbin/opnsense-update -sm %s', str_replace('/', '\/', $_POST['mirror']));
|
||||
$config['system']['firmware']['mirror'] = $_POST['mirror'];
|
||||
}
|
||||
if ($_POST['flavour'] == 'default' && isset($config['system']['firmware']['flavour'])) {
|
||||
/* default does not set anything for backwards compat */
|
||||
unset($config['system']['firmware']['flavour']);
|
||||
} else {
|
||||
/* XXX create a proper backend call */
|
||||
mwexecf('/usr/local/sbin/opnsense-update -sn %s', str_replace('/', '\/', $_POST['flavour']));
|
||||
$config['system']['firmware']['flavour'] = $_POST['flavour'];
|
||||
}
|
||||
|
||||
@ -347,6 +315,7 @@ if ($_POST) {
|
||||
elseif (isset($config['unbound']['enable']))
|
||||
$retval |= services_unbound_configure();
|
||||
$retval |= system_timezone_configure();
|
||||
$retval |= system_firmware_configure();
|
||||
$retval |= system_ntp_configure();
|
||||
|
||||
if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user