Remove all additional packages from the system before reset to factory default. Fixes #5829

This commit is contained in:
Renato Botelho 2016-02-01 10:41:44 -02:00
parent aecade14d0
commit 7222324e2a
3 changed files with 6 additions and 0 deletions

View File

@ -624,6 +624,10 @@ function write_config($desc="Unknown", $backup = true, $write_config_only = fals
function reset_factory_defaults($lock = false, $reboot_required = true) {
global $g;
/* Remove all additional packages */
mwexec("/bin/sh /usr/local/sbin/{$g['product_name']}-upgrade -r ALL_PACKAGES");
conf_mount_rw();
if (!$lock) {
$lockkey = lock('config', LOCK_EX);

View File

@ -2090,6 +2090,7 @@ function system_check_reset_button() {
***********************************************************************
* Reset button pressed - resetting configuration to factory defaults. *
* All additional packages installed will be removed *
* The system will reboot after this completes. *
***********************************************************************

View File

@ -38,6 +38,7 @@
echo "\n" . gettext("You are about to reset the firewall to factory defaults.");
echo "\n" . gettext("The firewall will reboot after resetting the configuration.");
echo "\n" . gettext("All additional packages installed will be removed.");
echo "\n" . gettext("Do you want to proceed [y|n]?") . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {