Commit 9346e898 authored by Franco Fichtner's avatar Franco Fichtner

config: another factory reset follow-up #124

parent 15016f4d
...@@ -198,10 +198,8 @@ function write_config($desc = 'Unknown', $backup = true) ...@@ -198,10 +198,8 @@ function write_config($desc = 'Unknown', $backup = true)
* RESULT * RESULT
* integer - indicates completion * integer - indicates completion
******/ ******/
function reset_factory_defaults() function reset_factory_defaults($sync = true)
{ {
$lockkey = lock('config', LOCK_EX);
/* create conf directory, if necessary */ /* create conf directory, if necessary */
@mkdir('/conf'); @mkdir('/conf');
...@@ -219,12 +217,15 @@ function reset_factory_defaults() ...@@ -219,12 +217,15 @@ function reset_factory_defaults()
/* call the wizard */ /* call the wizard */
touch('/conf/trigger_initial_wizard'); touch('/conf/trigger_initial_wizard');
unlock($lockkey);
setup_serial_port(); setup_serial_port();
/* as we go through a special case directly reboot */ /* as we go through a special case directly reboot */
mwexec('/sbin/shutdown -or now'); $shutdown_cmd = '/sbin/shutdown -or now';
if ($sync) {
mwexec($shutdown_cmd);
} else {
mwexec_bg($shutdown_cmd);
}
} }
function config_restore($conffile) { function config_restore($conffile) {
......
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2004-2009 Scott Ullrich
...@@ -48,8 +49,7 @@ include("head.inc"); ...@@ -48,8 +49,7 @@ include("head.inc");
print_info_box(gettext("The system has been reset to factory defaults and is now rebooting. This may take a few minutes, depending on your hardware.")); ?> print_info_box(gettext("The system has been reset to factory defaults and is now rebooting. This may take a few minutes, depending on your hardware.")); ?>
<pre> <pre>
<?php <?php
reset_factory_defaults(); reset_factory_defaults(false);
system_reboot();
?> ?>
</pre> </pre>
<?php else: ?> <?php else: ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment