From a35f277d568250d28f97b85569d9afa2f490ca9d Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 3 Apr 2015 11:17:20 +0200 Subject: [PATCH] wizard: do not write a file to trigger initial wizard --- src/bin/viconfig | 2 -- src/etc/config.xml | 1 + src/etc/inc/config.lib.inc | 17 +----------- src/www/index.php | 2 +- src/www/wizards/setup_wizard.xml | 45 +++++++++++++++++--------------- 5 files changed, 27 insertions(+), 40 deletions(-) delete mode 100755 src/bin/viconfig diff --git a/src/bin/viconfig b/src/bin/viconfig deleted file mode 100755 index 9de7812ad..000000000 --- a/src/bin/viconfig +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -vi /conf/config.xml diff --git a/src/etc/config.xml b/src/etc/config.xml index adc25feba..141e24590 100644 --- a/src/etc/config.xml +++ b/src/etc/config.xml @@ -1,5 +1,6 @@ + 9.9 opnsense diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index e46dfd10c..96d4fa927 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -200,23 +200,8 @@ function write_config($desc = 'Unknown', $backup = true) ******/ function reset_factory_defaults($sync = true) { - /* create conf directory, if necessary */ - @mkdir('/conf'); - - /* clear out /conf */ - $dh = opendir('/conf'); - while ($filename = readdir($dh)) { - if (($filename != '.') && ($filename != '..')) { - unlink_if_exists('/conf/' . $filename); - } - } - closedir($dh); - + unlink_if_exists('/conf/*' . $filename); disable_security_checks(); - - /* call the wizard */ - touch('/conf/trigger_initial_wizard'); - setup_serial_port(); /* as we go through a special case directly reboot */ diff --git a/src/www/index.php b/src/www/index.php index 56dfa3d9b..b03c4e47a 100644 --- a/src/www/index.php +++ b/src/www/index.php @@ -402,7 +402,7 @@ echo $jscriptstr; + if (isset($config['trigger_initial_wizard'])) : ?>

!

diff --git a/src/www/wizards/setup_wizard.xml b/src/www/wizards/setup_wizard.xml index 0deb4c7cb..4a39b9067 100644 --- a/src/www/wizards/setup_wizard.xml +++ b/src/www/wizards/setup_wizard.xml @@ -2,30 +2,30 @@ /* - Copyright (C) 2014 Deciso B.V. - Copyright (C) 2004, 2005 Scott Ullrich - All rights reserved. + Copyright (C) 2014 Deciso B.V. + Copyright (C) 2004, 2005 Scott Ullrich + 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. + 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. + 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. */ 9 @@ -41,7 +41,10 @@ - unlink_if_exists('/conf/trigger_initial_wizard'); + if (isset($config['trigger_initial_wizard'])) { + unset($config['trigger_initial_wizard']); + write_config(gettext("Triggered initial wizard")); + }