[merged]
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Tue, 28 Jan 2014 14:31:21 +0100
changeset 41 b761702df772
parent 40 d0410b54a231 (current diff)
parent 25 ecd7c783aba4 (diff)
child 42 9b16171463ba
[merged]
plugins/check_amanda-client
--- 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}
--- 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;