diff options
author | doktornotor <notordoktor@gmail.com> | 2015-09-27 18:35:06 +0200 |
---|---|---|
committer | doktornotor <notordoktor@gmail.com> | 2015-09-27 18:35:06 +0200 |
commit | 0c2f769c0a2a8481c1b731df54ea0e5439dd20cb (patch) | |
tree | 7eacb5cc6d172446a5c64ee1867c4ec8d264b6cd | |
parent | 0b74438e962ead448d144f7f246f599efe01c7a9 (diff) | |
download | pfsense-0c2f769c0a2a8481c1b731df54ea0e5439dd20cb.zip pfsense-0c2f769c0a2a8481c1b731df54ea0e5439dd20cb.tar.gz |
Remove syslog.conf entries on package uninstall (Bug #5210) - RELENG_2_2
The remove_text_from_file() is not needed at all. However, system_syslogd_start() must be run after the package entries are gone from config.xml, otherwise system_syslogd_start() just re-adds the (now almost removed) package logging configuration from there.
-rw-r--r-- | etc/inc/pkg-utils.inc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index fe19054..2435495 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -1187,17 +1187,16 @@ function delete_package_xml($pkg) { update_output_window($static_output); } /* syslog */ + $need_syslog_restart = false; if(is_array($pkg_info['logging']) && $pkg_info['logging']['logfilename'] <> "") { $static_output .= "Syslog entries... "; update_output_window($static_output); - remove_text_from_file("/etc/syslog.conf", $pkg_info['logging']['facilityname'] . "\t\t\t\t" . $pkg_info['logging']['logfilename']); - system_syslogd_start(); @unlink("{$g['varlog_path']}/{$pkg_info['logging']['logfilename']}"); $static_output .= "done.\n"; update_output_window($static_output); + $need_syslog_restart = true; } - conf_mount_ro(); /* remove config.xml entries */ $static_output .= gettext("Configuration... "); update_output_window($static_output); @@ -1205,6 +1204,14 @@ function delete_package_xml($pkg) { $static_output .= gettext("done.") . "\n"; update_output_window($static_output); write_config("Removed {$pkg} package.\n"); + + /* remove package entry from /etc/syslog.conf if needed */ + /* this must to be done after removing the entries from config.xml */ + if ($need_syslog_restart) { + system_syslogd_start(); + } + + conf_mount_ro(); } function expand_to_bytes($size) { |