From da381f63e51554a17932c37ff0406abd9650a239 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 16 May 2007 20:18:15 +0000 Subject: add hardlink_filtered function to hardlink recursively file list to a directory (using rsync --files-from --link-dest) --- draklive | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/draklive b/draklive index bb1c7aa..d96f120 100755 --- a/draklive +++ b/draklive @@ -752,6 +752,20 @@ sub expand_file_list { } @files; } +#- hardlink recursively file list to a directory +sub hardlink_filtered { + my ($src, $dest, $files) = @_; + mkdir_p($dest); + my $pwd = $ENV{PWD}; + chdir($src); + my $list_file = tmpnam(); + output_p($list_file, map { "$_\n" } grep { -e $src . $_ } @$files); + #- cpio -pldm won't copy recursively, use rsync -r instead + system('rsync', '-ar', '--files-from=' . $list_file, '--link-dest=' . $src, $src, $dest); + unlink $list_file; + chdir($pwd); +} + sub create_loopback_files { my ($live) = @_; # umount filesystem in the live before creating the loopback -- cgit v1.2.1