--- fuse-comp.pl 2007/07/16 08:34:47 36 +++ fuse-comp.pl 2007/09/02 12:03:52 39 @@ -25,11 +25,13 @@ ); my $mount = { - from => '/tmp/comp', - to => '/tmp/no-comp', - tmp => '/dev/shm/comp', + from => shift @ARGV || '/tmp/comp', + to => shift @ARGV || '/tmp/no-comp', + tmp => shift @ARGV || '/dev/shm/comp', }; +warn "mount $mount->{from} to $mount->{to} using $mount->{tmp} as cache\n"; + my $skip_extensions_regex = qr/gz|gz%|\.(?:sw[a-z]|gif|png|jpeg|jpg|avi|rar|zip|bz2|tgz|avi|mpeg|mpg|tmp|temp)$/i; # don't compress files smaller than this @@ -356,8 +358,8 @@ warn "# symlink( $from_path -> $to_path ) = $rv\n" if $debug; my $tmp = $mount->{tmp} . '/' . $from; - if ( -e $tmp ) { - my $tmp_to = $mount->{$tmp} . '/' . $to; + my $tmp_to = $mount->{tmp} . '/' . $to; + if ( $rv == 0 && -e $tmp_to ) { symlink( $tmp, $tmp_to ) || confess "can't symlink $tmp -> $tmp_to: $!"; } return $rv;