Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
c78c9ced
Commit
c78c9ced
authored
Oct 10, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: weave new migrations into convert_config(); closes #1156
parent
15214186
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
24 deletions
+27
-24
+POST_INSTALL
+POST_INSTALL
+0
-3
config.lib.inc
src/etc/inc/config.lib.inc
+25
-20
rc.bootup
src/etc/rc.bootup
+1
-1
rc.configure_firmware
src/etc/rc.configure_firmware
+1
-0
No files found.
+POST_INSTALL
View file @
c78c9ced
...
...
@@ -38,9 +38,6 @@ fi
echo "Flush Phalcon volt templates"
rm -f /usr/local/opnsense/mvc/app/cache/*.php
echo "Execute model migrations"
/usr/local/opnsense/mvc/script/run_migrations.php
echo "Reloading GUI configuration"
/usr/local/etc/rc.php_ini_setup
if pgrep -q php-cgi; then
...
...
src/etc/inc/config.lib.inc
View file @
c78c9ced
...
...
@@ -40,12 +40,11 @@ $g = array(
"dhcpd_chroot_path"
=>
"/var/dhcpd"
,
"unbound_chroot_path"
=>
"/var/unbound"
,
"product_name"
=>
"OPNsense"
,
"product_website"
=>
"https://opnsense.org"
,
"product_website"
=>
"https://opnsense.org
/
"
,
"product_email"
=>
"project@opnsense.org"
,
"product_copyright_owner"
=>
"Deciso B.V."
,
"product_copyright_years"
=>
"2014-2016"
,
"product_copyright_url"
=>
"https://www.deciso.com/"
,
"latest_config"
=>
"11.2"
,
);
require_once
(
"xmlparse.inc"
);
...
...
@@ -118,39 +117,45 @@ function parse_config()
* null
******/
/* convert configuration, if necessary */
function
convert_config
()
function
convert_config
(
$verbose
=
false
)
{
global
$config
,
$g
;
global
$config
;
/* hardcode this, legacy migration path is now disabled */
$latest_config
=
'11.2'
;
if
(
!
isset
(
$config
[
'revision'
]))
{
/* force a revision tag for proper handling in config history */
write_config
(
'Factory configuration'
,
false
);
}
if
(
$config
[
'version'
]
==
$g
[
'latest_config'
])
{
/* already at latest version */
return
;
if
(
$config
[
'version'
]
!==
$latest_config
)
{
$prev_version
=
$config
[
'version'
];
/* Loop and run upgrade_VER_to_VER() until we're at current version */
while
(
$config
[
'version'
]
<
$latest_config
)
{
$cur
=
$config
[
'version'
]
*
10
;
$next
=
$cur
+
1
;
$migration_function
=
sprintf
(
'upgrade_%03d_to_%03d'
,
$cur
,
$next
);
if
(
function_exists
(
$migration_function
))
{
$migration_function
();
}
$config
[
'version'
]
=
sprintf
(
'%.1f'
,
$next
/
10
);
}
// Save off config version
$prev_version
=
$config
[
'version'
];
/* Loop and run upgrade_VER_to_VER() until we're at current version */
while
(
$config
[
'version'
]
<
$g
[
'latest_config'
])
{
$cur
=
$config
[
'version'
]
*
10
;
$next
=
$cur
+
1
;
$migration_function
=
sprintf
(
'upgrade_%03d_to_%03d'
,
$cur
,
$next
);
if
(
function_exists
(
$migration_function
))
{
$migration_function
();
if
(
$prev_version
!=
$config
[
'version'
])
{
write_config
(
sprintf
(
'Upgraded config version level from %s to %s'
,
$prev_version
,
$config
[
'version'
]));
}
$config
[
'version'
]
=
sprintf
(
'%.1f'
,
$next
/
10
);
}
if
(
$prev_version
!=
$config
[
'version'
])
{
write_config
(
sprintf
(
'Upgraded config version level from %s to %s'
,
$prev_version
,
$config
[
'version'
]));
/* chain the new migration into this function call */
$mvc_migration
=
'/usr/local/opnsense/mvc/script/run_migrations.php'
;
if
(
$verbose
)
{
passthru
(
$mvc_migration
);
}
else
{
mwexecf
(
$mvc_migraton
);
}
}
/****f* config/write_config
* NAME
* write_config - Backup and write the firewall configuration.
...
...
src/etc/rc.bootup
View file @
c78c9ced
...
...
@@ -96,7 +96,7 @@ if ($setup_installer) {
echo
"Loading configuration..."
;
global
$config
;
$config
=
parse_config
();
convert_config
();
convert_config
(
true
);
echo
"done.
\n
"
;
/*
...
...
src/etc/rc.configure_firmware
View file @
c78c9ced
...
...
@@ -37,3 +37,4 @@ require_once 'system.inc';
system_firmware_configure
();
system_console_configure
();
convert_config
(
true
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment