From 7222324e2a073d006ef55fcf36a5250bee73faef Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 1 Feb 2016 10:41:44 -0200 Subject: Remove all additional packages from the system before reset to factory default. Fixes #5829 --- src/etc/inc/config.lib.inc | 4 ++++ src/etc/inc/system.inc | 1 + src/etc/rc.initial.defaults | 1 + 3 files changed, 6 insertions(+) (limited to 'src/etc') diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index 41bc2af..d61cf17 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -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); diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 4806407..74ff903 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -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. * *********************************************************************** diff --git a/src/etc/rc.initial.defaults b/src/etc/rc.initial.defaults index c80a18d..3020cc2 100755 --- a/src/etc/rc.initial.defaults +++ b/src/etc/rc.initial.defaults @@ -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) { -- cgit v1.1