/var/lib/sorcery/modules/dl_handlers/dl_dir

     1	#!/bin/bash
     2	#---------------------------------------------------------------------
     3	##
     4	##=head1 SYNOPSIS
     5	##
     6	## Url handler functions for grabbing directory urls.
     7	##
     8	##=head1 DESCRIPTION
     9	##
    10	## This type of url was added as a response to the following request:
    11	##
    12	##   I'm an AbiWord developer, and I keep the latest source
    13	##   tree in my abi directory. If I could make the abi spell
    14	##   (not to be confused with the abispell) use my current
    15	##   CVS checked-out tree, that would  be nice.
    16	##
    17	## This file contains functions for I<downloading> (actually it just
    18	## copies, tars, and compresses) directories which can be accessed
    19	## through the local file system.
    20	##
    21	## Url's of this type are specified using the format
    22	##
    23	##  dir://<directory>
    24	##
    25	## where <directory> is the full path to a directory that will be
    26	## tarred and compressed for use by sorcery in casting a spell.
    27	##
    28	##=head1 COPYRIGHT
    29	##
    30	## Copyright 2002 by the Source Mage Team
    31	##
    32	##=head1 FUNCTIONS
    33	##
    34	##=over 4
    35	##
    36	#---------------------------------------------------------------------
    37	
    38	
    39	#---------------------------------------------------------------------
    40	##=item dl_get_dir <url>
    41	##
    42	## Copies the specified dir url.
    43	##
    44	#---------------------------------------------------------------------
    45	function url_dir_get() {
    46	
    47	  local target=$1
    48	  local url_list=$2
    49	  local hints=$3
    50	  local dl_target=$4
    51	  local dl_type=$5
    52	  local url rc=1
    53	  local DIRNAME
    54	
    55	  [[ $target ]] || return 255
    56	
    57	  for url in $url_list; do
    58	    DIRNAME=`url_dir_crack $url`
    59	    if  test -d  "$DIRNAME"  ; then
    60	      message "Copying $DIRNAME to $target."
    61	      cp  -aR  $DIRNAME $target &&
    62	      message "Finished."
    63	    fi
    64	  done
    65	
    66	  eval "$dl_target=\"$target\""
    67	  eval "$dl_type=\"tree\""
    68	  return $rc
    69	
    70	}
    71	
    72	#---------------------------------------------------------------------
    73	##=back
    74	##
    75	##=head1 LICENSE
    76	##
    77	## This software is free software; you can redistribute it and/or modify
    78	## it under the terms of the GNU General Public License as published by
    79	## the Free Software Foundation; either version 2 of the License, or
    80	## (at your option) any later version.
    81	##
    82	## This software is distributed in the hope that it will be useful,
    83	## but WITHOUT ANY WARRANTY; without even the implied warranty of
    84	## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    85	## GNU General Public License for more details.
    86	##
    87	## You should have received a copy of the GNU General Public License
    88	## along with this software; if not, write to the Free Software
    89	## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    90	##
    91	#---------------------------------------------------------------------