--- /usr/local/bin/mirror Mon Sep 27 13:56:04 1999 +++ mirror Wed May 29 17:40:34 2002 @@ -20,6 +20,19 @@ # # $Id: mirror.pl,v 2.9 1998/05/29 19:01:07 lmjm Exp lmjm $ # $Log: mirror.pl,v $ +# +# Revision 2.9ACRM 2002/05/29 17:15:00 acrm +# A couple of simple changes to allow compressed remote files to be +# stored uncompressed locally +# The package file needs: +# compress_prog=/usr/bin/gunzip +# compress_patt=\.(gz|Z)$ +# compress_excl= +# or, if you don't have gunzip or need only to handle .Z files +# compress_prog=/usr/bin/uncompress +# compress_patt=\.Z$ +# compress_excl= +# # Revision 2.9 1998/05/29 19:01:07 lmjm # Lots of changes. See CHANGES since 2.8 file. # @@ -434,7 +447,7 @@ sub msg_version { - &msg( '$Id: mirror.pl,v 2.9 1998/05/29 19:01:07 lmjm Exp lmjm $' . "\n" ); + &msg( '$Id: mirror.pl,v 2.9ACRM 1998/05/29 19:01:07 lmjm Exp lmjm $' . "\n" ); } parse_args: @@ -862,6 +875,8 @@ { local( $key, $val ); + $uncompress = 0; + while( ($key, $val) = each %value ){ # for things like passwords it is nice to have the # real value in a file @@ -897,6 +912,9 @@ $compress_prog = $gzip_prog; $compress_suffix = $gzip_suffix; } + elsif(( $val =~ /uncompress/ ) || ( $val =~ /gunzip/ )){ + $uncompress = 1; + } elsif( $debug > 2 && $compress_prog ne $gzip_prog && $compress_prog ne $sys_compress_prog ){ &msg( "compress_prog ($compress_prog) not compress or gzip, presuming program name\n" . @@ -2184,12 +2202,12 @@ # I'm about to do a lot of matching on this study( $src_path ); - # Should I compress this file? + # Should I compress this file? # Don't compress this file if trying to do a compress->gzip # conversion. $compress = 0; if( &will_compress( $src_path, $srci ) ){ - if( $dest_path !~ /$squished/o ){ + if(( $dest_path !~ /$squished/o ) || ($uncompress)){ $srciZ = $src_map{ "$src_path.$sys_compress_suffix" }; $srcigz = $src_map{ "$src_path.$gzip_suffix" }; if( $srciZ || $srcigz ){ @@ -2200,7 +2218,14 @@ } $compress = 1; - $dest_path .= '.' . $compress_suffix; + if($uncompress) + { + $dest_path =~ s/$compress_patt//; + } + else + { + $dest_path .= '.' . $compress_suffix; + } $desti = $dest_map{ $dest_path }; } }