diff -r 25921fa4d40f -r 0b560168af46 check_release.pl --- a/check_release.pl Thu May 30 10:17:43 2013 +0200 +++ b/check_release.pl Wed Jan 28 21:08:04 2015 +0100 @@ -1,6 +1,7 @@ #!/usr/bin/perl -w # Copyright (C) 2011 Christian Arnold +# Copyright (C) 2015 Heiko Schlittermann # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,7 +38,7 @@ sub version($$); my $ME = basename $0; -my $VERSION = "2.3"; +my $VERSION = "2.5"; my %opt = ( url => "http://www.debian.org/releases/stable/index.html", @@ -116,29 +117,24 @@ sub report($$) { my ($current_release, $stable_release) = @_; + + if ($opt{ok} or $current_release eq $stable_release) { + print "RELEASE OK: $current_release/$stable_release\n"; + exit $ERRORS{OK}; + } + $stable_release =~ /^(\d+)/ and my $stable_major = int($1); $current_release =~ /^(\d+)/ and my $current_major = int($1); - if ($current_major < $stable_major) { - if ($opt{ok}) { - print "RELEASE OK: $current_release/$stable_release\n"; - exit $ERRORS{OK}; - } + + if ($current_major - $stable_major < -1) { print "RELEASE CRITICAL: $current_release / $stable_release\n"; exit $ERRORS{CRITICAL}; } - if ($current_release ne $stable_release) { - if ($opt{ok}) { - print "RELEASE OK: $current_release/$stable_release\n"; - exit $ERRORS{OK}; - } print "RELEASE WARNING: $current_release / $stable_release\n"; exit $ERRORS{"WARNING"}; - } - print "RELEASE OK: $current_release/$stable_release\n"; - exit $ERRORS{"OK"}; } sub version($$) { @@ -146,7 +142,8 @@ print <<_VERSION; $progname version $version -Copyright (C) 2011 by Christian Arnold and Schlittermann internet & unix support. +Copyright (C) 2011-2013 by Christian Arnold and Schlittermann internet & unix support. +Copyright (C) 2015 by Schlittermann internet & unix support. $ME comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.