# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1390915881 -3600 # Node ID b761702df772813071e48256f4c1e12da47c0f88 # Parent d0410b54a231d6cc4262e8a15d5684f5770da5f0# Parent ecd7c783aba41b0e14f187dada7260b245483c2b [merged] diff -r d0410b54a231 -r b761702df772 Build.PL --- a/Build.PL Tue Jan 28 14:03:04 2014 +0100 +++ b/Build.PL Tue Jan 28 14:31:21 2014 +0100 @@ -19,8 +19,8 @@ 'nagios/plugins/ius/check_amanda-client', }, license => 'perl', - requires => { perl => 5.014, }, - test_requires => { 'Test::Exception' => 0, }, + requires => { perl => 5.014, 'Const::Fast' => 0.011 }, + build_requires => { 'Test::Exception' => 0, }, ); # some magic to install it to the proper location} diff -r d0410b54a231 -r b761702df772 plugins/check_amanda-client --- a/plugins/check_amanda-client Tue Jan 28 14:03:04 2014 +0100 +++ b/plugins/check_amanda-client Tue Jan 28 14:31:21 2014 +0100 @@ -62,6 +62,9 @@ *::verbose = $opt_verbose ? sub { say '# ', @_ } : sub { }; + verbose('setting working directory to /, this avoids permission problems'); + chdir '/'; + # test needs to be run as root:* or as backup:backup # change to backup if still root su $USER if $> == 0; @@ -128,7 +131,7 @@ sub find_tool { my $name = shift; my @rc = grep { -f -x } map { catfile $_, $name } split /:/, $ENV{PATH} - or die "Can't find `$name' in $ENV{PATH}\n"; + or die "Can't find executable `$name' in $ENV{PATH}\n"; $rc[0]; } @@ -148,8 +151,13 @@ my $f_mode = (stat _)[2] & 07777 or die $!; my $msg = - sprintf "need: 0%04o root:$group, got: 0%04o $f_owner:$f_group\n", - $mode, $f_mode; + sprintf "need: 0%04o root:%s, got: 0%04o %s:%s\n", + $mode, $group, $f_mode, $f_owner, $f_group; + + if (-f '/etc/debian_version') { + $msg .= sprintf "try dpkg-statoverride --update --add root %sgroup 0%04o %s\n", + $group, $mode, $file; + } die $msg unless $f_owner eq $owner; die $msg unless $f_group eq $group;