diff options
author | jim-p <jimp@pfsense.org> | 2012-04-30 15:32:47 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-04-30 15:32:47 -0400 |
commit | 60dd7649d02e4a82f9d57953359bf312038f174a (patch) | |
tree | 897e75ee018c10aa727b9d03536b5210b7e424e9 /etc/inc | |
parent | 15855fbc5bb1c59bf9efc5221df2fb051a9d27c9 (diff) | |
download | pfsense-60dd7649d02e4a82f9d57953359bf312038f174a.zip pfsense-60dd7649d02e4a82f9d57953359bf312038f174a.tar.gz |
Move the stop_packages code to a function, and call the function from the shell script, and call the function directly for a reboot. Fixes #2402 and ticket #1564
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 44 | ||||
-rw-r--r-- | etc/inc/system.inc | 3 |
2 files changed, 46 insertions, 1 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 88a58e7..e9fcf01 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -1254,4 +1254,48 @@ function pkg_reinstall_all() { } } +function stop_packages() { + require_once("config.inc"); + require_once("functions.inc"); + require_once("filter.inc"); + require_once("shaper.inc"); + require_once("captiveportal.inc"); + require_once("pkg-utils.inc"); + require_once("pfsense-utils.inc"); + require_once("service-utils.inc"); + + global $config, $g, $rcfileprefix; + + log_error("Stopping all packages."); + + $rcfiles = glob("{$rcfileprefix}*.sh"); + if (!$rcfiles) + $rcfiles = array(); + else { + $rcfiles = array_flip($rcfiles); + if (!$rcfiles) + $rcfiles = array(); + } + + if (is_array($config['installedpackages']['package'])) { + foreach($config['installedpackages']['package'] as $package) { + echo " Stopping package {$package['name']}..."; + stop_service($package['name']); + unset($rcfiles["{$rcfileprefix}{$package['name']}.sh"]); + echo "done.\n"; + } + } + + $shell = @popen("/bin/sh", "w"); + if ($shell) { + foreach ($rcfiles as $rcfile => $number) { + echo " Stopping {$rcfile}..."; + fwrite($shell, "{$rcfile} stop >>/tmp/bootup_messages 2>&1"); + echo "done.\n"; + } + + pclose($shell); + } +} + ?> diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 8b13f69..cfcb20c 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1345,7 +1345,8 @@ function system_reboot_cleanup() { captiveportal_radius_stop_all(); require_once("voucher.inc"); voucher_save_db_to_config(); - mwexec("/etc/rc.stop_packages"); + require_once("pkg-utils.inc"); + stop_packages(); } function system_do_shell_commands($early = 0) { |