[Bins] Re: Bug#334064: bins: option to use ln instead of cp

Martin Michlmayr tbm at cyrius.com
Fri Nov 4 15:10:24 GMT 2005


* Tim Connors <tconnors+reportbug at astro.swin.edu.au> [2005-10-15 21:05]:
> Ooops, forgot about linkInsteadOfCopy -- I thought I had that set, but
> obviously not.
> 
> However, it doesn't appear to operate on movie files, which is what we
> most want it to operate on.  See line 1852.

Yeah, it appears such files as unconditionally copied.  Here's support
for linkInsteadOfCopy for such files:


--- /usr/bin/bins	2005-10-15 16:02:07.000000000 +0100
+++ bins	2005-11-04 14:16:44.000000000 +0000
@@ -1849,7 +1849,20 @@
                     my $from="$picdir$album$fileInAlbum";
                     my $to="$albumdir$album$fileInAlbum";
                     if ( ! -f $to ) {
-                        `cp -p "$from" "$to"`;
+                        if ($configHash->{linkInsteadOfCopy}) {
+                            my $newpath;
+                            if ($configHash->{linkRelative}) {
+                                $newpath = relpath($to, $from);
+                            } else {
+                                $newpath = $from;
+                            }
+                            beVerboseN("Linking from $to to $newpath...", 2);
+                            system("ln", "-sf", $newpath, $to) == 0
+                                or die("\nCannot link $to to $newpath: $?");
+                        } else {
+                            beVerboseN("Copying from $from to $to...", 2);
+                            `cp -p "$from" "$to"`;
+                        }
                     }
                 }
             }


-- 
Martin Michlmayr
http://www.cyrius.com/


More information about the Bins mailing list