X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=restore.pl;h=53b48dc4e2e2922e5f008100c477e304f60e8744;hb=57890fff9773a368f241a25c89931a5d67fccb4e;hp=e7bb5ff6c617ba41580f95a9f651675dfead7d11;hpb=8d214d152f61b8d2ed31a238b0f71650975fe3d3;p=cumulus.git diff --git a/restore.pl b/restore.pl index e7bb5ff..53b48dc 100755 --- a/restore.pl +++ b/restore.pl @@ -166,7 +166,7 @@ sub iterate_objects { next if $obj eq ""; if ($obj =~ /^@(\S+)$/) { my $indirect = load_ref($1); - iterate_objects($callback, $arg, $1, $recursion_level + 1); + iterate_objects($callback, $arg, $indirect, $recursion_level + 1); } else { &$callback($arg, $obj); } @@ -266,13 +266,20 @@ sub process_file { # Restore mode, ownership, and any other metadata for the file. This is # split out from the code above since the code is the same regardless of # file type. - my $atime = $info{atime} || time(); my $mtime = $info{mtime} || time(); - utime $atime, $mtime, $dest - or warn "Unable to update atime/mtime for $dest"; - - my $uid = $info{user} || -1; - my $gid = $info{group} || -1; + utime time(), $mtime, $dest + or warn "Unable to update mtime for $dest"; + + my $uid = -1; + my $gid = -1; + if (defined $info{user}) { + my @items = split /\s/, $info{user}; + $uid = $items[0] + 0 if exists $items[0]; + } + if (defined $info{group}) { + my @items = split /\s/, $info{group}; + $gid = $items[0] + 0 if exists $items[0]; + } chown $uid, $gid, $dest or warn "Unable to change ownership for $dest"; @@ -371,8 +378,8 @@ print "Source directory: $OBJECT_DIR\n" if $VERBOSE; open DESCRIPTOR, "<", $descriptor or die "Cannot open backup descriptor file $descriptor: $!"; my $line = ; -if ($line !~ m/^root: (\S+)$/) { - die "Expected 'root:' specification in backup descriptor file"; +if ($line !~ m/^Root: (\S+)$/) { + die "Expected 'Root:' specification in backup descriptor file"; } my $root = $1; close DESCRIPTOR;