aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2011-01-25 14:57:43 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2011-01-25 14:57:43 +0000
commite6ce1a5063994e1a1cbe30919726f458d558df71 (patch)
tree95213f1cbc6c3c7eebaf217381691e31c52bb17a
parentee84369f0933d54f563bc6566e8dcf4fc34e0ac4 (diff)
downloadrpm-helper-e6ce1a5063994e1a1cbe30919726f458d558df71.tar
rpm-helper-e6ce1a5063994e1a1cbe30919726f458d558df71.tar.gz
rpm-helper-e6ce1a5063994e1a1cbe30919726f458d558df71.tar.bz2
rpm-helper-e6ce1a5063994e1a1cbe30919726f458d558df71.tar.xz
rpm-helper-e6ce1a5063994e1a1cbe30919726f458d558df71.zip
- make add/del-syslog code more generic
-rwxr-xr-xadd-syslog7
-rwxr-xr-xdel-syslog7
2 files changed, 8 insertions, 6 deletions
diff --git a/add-syslog b/add-syslog
index dd51527..d24de7a 100755
--- a/add-syslog
+++ b/add-syslog
@@ -44,15 +44,16 @@ EOF
die "maximum priority '$max' lower than minimum priority '$min'"
if $min && $max && ($priorities{$max} < $priorities{$min});
- open(my $fh, '<', '/etc/mandriva-release')
- or die "can't open /etc/mandriva-release: $!";
+ my $release_file = '/etc/release';
+ open(my $fh, '<', $release_file)
+ or die "can't open $release_file: $!";
my $line = <$fh>;
$line =~ /^Mandriva Linux release (\d\d\d\d\.\d)/;
my $release = $1;
close($fh);
# add an entry to default syslog implementation, if installed
- if (version->parse($release) < version->parse("2010.1")) {
+ if ($release && version->parse($release) < version->parse("2010.1")) {
add_sysklogd_entry($package, $source, $dest, $facility, $min, $max)
if -f '/etc/init.d/syslog';
} else {
diff --git a/del-syslog b/del-syslog
index 62b9767..cf6b90f 100755
--- a/del-syslog
+++ b/del-syslog
@@ -14,14 +14,15 @@ EOF
# don't do anything for upgrade
exit(0) if $number == 1;
- open(my $fh, '<', '/etc/mandriva-release')
- or die "can't open /etc/mandriva-release: $!";
+ my $release_file = '/etc/release';
+ open(my $fh, '<', $release_file)
+ or die "can't open $release_file: $!";
my $line = <$fh>;
$line =~ /^Mandriva Linux release (\d\d\d\d\.\d)/;
my $release = $1;
close($fh);
- if (version->parse($release) < version->parse("2010.1")) {
+ if ($release && version->parse($release) < version->parse("2010.1")) {
del_sysklogd_entry($package);
} else {
del_rsyslog_entry($package);