aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mageia.org>2012-03-08 19:16:26 +0000
committerGuillaume Rousse <guillomovitch@mageia.org>2012-03-08 19:16:26 +0000
commitd8f6c7268e00b808d9d59c0624aee83ab6f5aab0 (patch)
treeaac431a3d17d6bb12413cb9dc96d3b82384d870a
parent332c90458b9c88f04291a84fb62135d7f058ac01 (diff)
downloadrpm-helper-d8f6c7268e00b808d9d59c0624aee83ab6f5aab0.tar
rpm-helper-d8f6c7268e00b808d9d59c0624aee83ab6f5aab0.tar.gz
rpm-helper-d8f6c7268e00b808d9d59c0624aee83ab6f5aab0.tar.bz2
rpm-helper-d8f6c7268e00b808d9d59c0624aee83ab6f5aab0.tar.xz
rpm-helper-d8f6c7268e00b808d9d59c0624aee83ab6f5aab0.zip
actually, we don't care about sysklogd at all anymore
-rw-r--r--README4
-rwxr-xr-xadd-syslog39
-rwxr-xr-xdel-syslog36
3 files changed, 4 insertions, 75 deletions
diff --git a/README b/README
index 0dae0a9..438e3e3 100644
--- a/README
+++ b/README
@@ -41,7 +41,7 @@ Remove given shell from the list of available system shells.
%_post_syslogadd <destination> [-s <source>] [-f <facility>] [-m <min>] [-M <max>]
Add a syslog entry, with given destination (usually a log file), and returns
-used facility. Support sysklogd and rsyslog.
+used facility. Support rsyslog only.
Optional arguments:
-s: ensure given source (usually /dev/log) is readable by syslog daemon.
-f: use given facility (otherwise first available local one is used).
@@ -49,7 +49,7 @@ Optional arguments:
-M: use given maximal priority.
%_preun_syslogdel
-Delete syslog entry created by previous macro. Support sysklogd and rsyslog.
+Delete syslog entry created by previous macro. Support rsyslog only.
%_post_webapp
Handle apache configuration reloading if needed when adding a web application.
diff --git a/add-syslog b/add-syslog
index 50cec83..a6139ff 100755
--- a/add-syslog
+++ b/add-syslog
@@ -44,44 +44,7 @@ EOF
die "maximum priority '$max' lower than minimum priority '$min'"
if $min && $max && ($priorities{$max} < $priorities{$min});
- my $release_file = '/etc/release';
- open(my $fh, '<', $release_file)
- or die "can't open $release_file: $!";
- my $line = <$fh>;
- $line =~ /^Mageia release (\d\d\d\d\.\d)/;
- my $release = $1;
- close($fh);
-
- # add an entry to default syslog implementation, if installed
- add_rsyslog_entry($package, $source, $dest, $facility, $min, $max)
- if -f '/etc/init.d/rsyslog';
-}
-
-sub add_sysklogd_entry {
- my ($package, $source, $dest, $facility, $min, $max) = @_;
-
- # ensure source is configured
- add_new_source($source, '/etc/sysconfig/syslog')
- if $source ne '/dev/log';
-
- # compute selector
- my $selector = get_selector($facility, $min, $max);
-
- # compute spacing to keep default configuration file formatting
- my $tabs = length($selector) < 48 ?
- ((48 - length($selector)) / 8) :
- 1;
-
- # append entry
- open(my $out, '>>', '/etc/syslog.conf')
- or die "Can't open /etc/syslog.conf for appending: $!";
- print $out "# BEGIN: Automatically added by $package installation\n";
- print $out "$selector" . ("\t" x $tabs) . "-$dest\n";
- print $out "# END\n";
- close($out);
-
- # relaunch syslog
- system('service syslog condrestart 2>&1 >/dev/null');
+ add_rsyslog_entry($package, $source, $dest, $facility, $min, $max);
}
sub add_rsyslog_entry {
diff --git a/del-syslog b/del-syslog
index 456ffe0..c5c9725 100755
--- a/del-syslog
+++ b/del-syslog
@@ -14,41 +14,7 @@ EOF
# don't do anything for upgrade
exit(0) if $number == 1;
- my $release_file = '/etc/release';
- open(my $fh, '<', $release_file)
- or die "can't open $release_file: $!";
- my $line = <$fh>;
- $line =~ /^Mageia release (\d\d\d\d\.\d)/;
- my $release = $1;
- close($fh);
-
- del_rsyslog_entry($package);
-}
-
-sub del_sysklogd_entry {
- my ($package) = @_;
-
- my $file = "/etc/syslog.conf";
-
- my $content;
- open(my $in, '<', $file)
- or die "Can't open $file for reading: $!";
- while (my $line = <$in>) {
- if ($line =~ /^# BEGIN: Automatically added by $package installation$/) {
- while ($line = <$in>) {
- last if $line =~ /^# END$/;
- }
- } else {
- $content .= $line;
- }
- }
-
- open(my $out, '>', $file)
- or die "Can't open $file for writing: $!";
- print $out $content;
- close($out);
-
- system('service syslog condrestart 2>&1 >/dev/null');
+ del_rsyslog_entry($package);
}
sub del_rsyslog_entry {