Ambrose Li wrote:
On 21/09/2007, Rich Rauenzahn <[EMAIL PROTECTED]> wrote:
Not familiar with MACs -- but -- shouldn't the mountpoint have
permissions such that only the OS can add directories?

That's not exactly how things work on Macs. They have a /tmp-like
directory /Volumes in which mount points can be created. When
a drive is connected, the automounter would create a mount point
that is unique to the current user, then mounts the volume. So it
really is meaningless to talk about permissions of the mount
points because they do not exist until the automounter (or
something else, in this case BackupPC) creates them.

So if something creates a directory that has the same name as
a mount point, the automounter will mistakenly think that it (the
automounter) has created that directory for another user, and
will happily create another mount point (with a slightly different
name) for the volume. This guarantees that the directory
created by BackupPC will never be the actual mount point used
by the automounter.

Ah, then, I'd agree with the other poster -- create a unique .dotfile or something on your volume and test for it. Or set it to be owned by backuppc:backuppc and test for that owner..

#!/usr/bin/perl -w
use strict;

my $dir = "/.RAID/BackupPC";
#my $dir = "/.RAID";

# modified find2perl output...

# for lookup by name...
my (%uid, %user);
while (my ($name, $pw, $uid) = getpwent) {
   $uid{$name} = $uid{$uid} = $uid;
}

my ($dev,$ino,$mode,$nlink,$uid,$gid);

if((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($dir)) &&
  -d _ &&
($uid == $uid{'backuppc'})) # you could test for the actual number instead
{
  print "good\n";
} else {
  print "bad\n";
}

Rich
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Reply via email to