X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=contrib%2Frestore.pl;fp=contrib%2Frestore.pl;h=0c7ee21e408bdf8196304303c1e6f12d57ad3dc6;hb=020917702127ad12881c8868bb649a685c561def;hp=ad1f5949840fc1ef9caa20e7a4816d6b6fff1e36;hpb=dbc502263438b4ba798f74a372c2a79fdc3061f4;p=cumulus.git diff --git a/contrib/restore.pl b/contrib/restore.pl index ad1f594..0c7ee21 100755 --- a/contrib/restore.pl +++ b/contrib/restore.pl @@ -243,7 +243,7 @@ sub process_file { # Restore the specified file. How to do so depends upon the file type, so # dispatch based on that. my $dest = "$DEST_DIR/$filename"; - if ($type eq '-') { + if ($type eq '-' || $type eq 'f') { # Regular file unpack_file($filename, %info); } elsif ($type eq 'd') { @@ -253,11 +253,12 @@ sub process_file { } } elsif ($type eq 'l') { # Symlink - if (!defined($info{contents})) { + my $target = $info{target} || $info{contents}; + if (!defined($target)) { die "Symlink $filename has no value specified"; } - my $contents = uri_decode($info{contents}); - symlink $contents, $dest + $target = uri_decode($target); + symlink $target, $dest or die "Cannot create symlink $filename: $!"; # TODO: We can't properly restore all metadata for symbolic links