From: Michael Vrable Date: Tue, 15 May 2007 22:57:24 +0000 (-0700) Subject: Handle new-style user/group entries in the restore script. X-Git-Url: http://git.vrable.net/?a=commitdiff_plain;h=e9f1696cb992030aeeb545526d043b4ab6c8658e;p=cumulus.git Handle new-style user/group entries in the restore script. The new style is uid (username) and was previously causing a warning since the entire string is not numeric, just the first part. Now explicitly split it apart. (For now, we ignore the username string, but it could possibly be used in the future.) --- diff --git a/restore.pl b/restore.pl index be94078..c7b4cca 100755 --- a/restore.pl +++ b/restore.pl @@ -272,8 +272,14 @@ sub process_file { my $uid = -1; my $gid = -1; - $uid = $info{user} + 0 if defined $info{user}; - $gid = $info{group} + 0 if defined $info{group}; + 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";