From 0c2f769c0a2a8481c1b731df54ea0e5439dd20cb Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 27 Sep 2015 18:35:06 +0200 Subject: 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. --- etc/inc/pkg-utils.inc | 13 ++++++++++--- 1 file 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) { -- cgit v1.1