From ce7edffff26e91ec9ccbb532ac023bccaff74b83 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 27 Sep 2015 18:39:32 +0200 Subject: Remove syslog.conf entries on package uninstall (Bug #5210) 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. --- src/etc/inc/pkg-utils.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index d4a1ec4..90d2e63 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -863,14 +863,14 @@ function delete_package_xml($package_name, $when = "post-deinstall") { } } /* 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; } /* remove config.xml entries */ @@ -880,6 +880,13 @@ function delete_package_xml($package_name, $when = "post-deinstall") { $static_output .= gettext("done.") . "\n"; update_output_window($static_output); write_config("Removed {$package_name} 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(); } -- cgit v1.1 From f164ace44a5045e9f05e10b24ce2842a04e0be4e Mon Sep 17 00:00:00 2001 From: doktornotor Date: Mon, 28 Sep 2015 08:43:29 +0200 Subject: Fix comment language --- src/etc/inc/pkg-utils.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index 90d2e63..0e9107b 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -882,7 +882,7 @@ function delete_package_xml($package_name, $when = "post-deinstall") { write_config("Removed {$package_name} package.\n"); /* remove package entry from /etc/syslog.conf if needed */ - /* this must to be done after removing the entries from config.xml */ + /* this must be done after removing the entries from config.xml */ if ($need_syslog_restart) { system_syslogd_start(); } -- cgit v1.1