plugins/check_amanda-client
changeset 41 b761702df772
parent 40 d0410b54a231
parent 25 ecd7c783aba4
child 44 8d2c3b246651
--- 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;