diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2010-01-25 21:28:31 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2010-01-25 21:28:31 +0000 |
commit | 6fb6bb98b1b37df0069b1ec8cb268393650cc6dd (patch) | |
tree | faf48cd47cc0c20052ecf77e2e669cb7bc079669 /del-syslog | |
parent | 480d2b551cc5fceef31ee366a06b3c15d660bbea (diff) | |
download | rpm-helper-6fb6bb98b1b37df0069b1ec8cb268393650cc6dd.tar rpm-helper-6fb6bb98b1b37df0069b1ec8cb268393650cc6dd.tar.gz rpm-helper-6fb6bb98b1b37df0069b1ec8cb268393650cc6dd.tar.bz2 rpm-helper-6fb6bb98b1b37df0069b1ec8cb268393650cc6dd.tar.xz rpm-helper-6fb6bb98b1b37df0069b1ec8cb268393650cc6dd.zip |
make it testable
Diffstat (limited to 'del-syslog')
-rwxr-xr-x | del-syslog | 36 |
1 files changed, 22 insertions, 14 deletions
@@ -3,28 +3,33 @@ # $Id$ use strict; -die <<EOF if @ARGV < 2; +main(@ARGV) unless caller(); + +sub main { + die <<EOF if @ARGV < 2; usage: $0 <pkg> <nb> EOF -my ($package, $number) = @ARGV; + my ($package, $number) = @ARGV; -# don't do anything for upgrade -exit(0) if $number == 1; + # 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 $line = <$fh>; -$line =~ /^Mandriva Linux release (\d\d\d\d\.\d)/; -my $release = $1; -close($fh); + open(my $fh, '<', '/etc/mandriva-release') + or die "can't open /etc/mandriva-release: $!"; + 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")) { - del_sysklogd_entry($package); -} else { - del_rsyslog_entry($package); + if (version->parse($release) < version->parse("2010.1")) { + del_sysklogd_entry($package); + } else { + del_rsyslog_entry($package); + } } sub del_sysklogd_entry { + my ($package) = @_; my $file = "/etc/syslog.conf"; my $content; @@ -49,6 +54,7 @@ sub del_sysklogd_entry { } sub del_rsyslog_entry { + my ($package) = @_; my $file = "/etc/rsyslog.d/$package.conf"; @@ -63,3 +69,5 @@ sub del_rsyslog_entry { or die "Can't delete $file: $!"; system(qw/service rsyslog condrestart/); } + +1; |