/var/lib/sorcery/modules/url_handlers/url_rsync
1 #!/bin/bash
2 #---------------------------------------------------------------------
3 ##
4 ##=head1 SYNOPSIS
5 ##
6 ## Url handler functions for grabbing rsync urls.
7 ##
8 ##=head1 DESCRIPTION
9 ##
10 ## This file contains functions for I<downloading> files through rsync.
11 ##
12 ## In order for rsync urls to be downloaded, the I<rsync> spell must have been
13 ## cast. This script first determines if rsync has been installed before
14 ## attempting to download a rsync url.
15 ##
16 ##=head1 RSYNC URL Format
17 ##
18 ##
19 ## rsync://SERVER::MODULE_NAME
20 ##
21 ## The above url will download the latest version of the specified
22 ## module.
23 ##
24 ##=head1 EXAMPLES
25 ##
26 ## Suppose we want to download the latest version of the sorcery
27 ## stable grimoire via rsync. We'd use the following url:
28 ##
29 ## rsync://codex.sourcemage.org::stable
30 ##
31 ##=head1 IMPLEMENTATION NOTE
32 ##
33 ## Downloading is supported but rsync url verification is not
34 ## currently supported.
35 ##
36 ##=head1 COPYRIGHT
37 ##
38 ## Copyright 2003 by the Source Mage Team
39 ##
40 ##=head1 FUNCTIONS
41 ##
42 ##=over 4
43 ##
44 #---------------------------------------------------------------------
45
46
47 #---------------------------------------------------------------------
48 ##=item url_rsync_crack <url>
49 ##
50 ## No cracking is needed on these urls currently.
51 ## Simply outputs the input.
52 ##
53 #---------------------------------------------------------------------
54 function url_rsync_crack() {
55 url_strip_prefix "$1" rsync
56 }
57
58
59 #---------------------------------------------------------------------
60 ##=item url_rsync_hostname <url>
61 ##
62 ## Gets the hostname for this rsync type url
63 ##
64 #---------------------------------------------------------------------
65 function url_rsync_hostname() {
66 echo $1|sed 's|^.*//\(.*\)::.*$|\1|'
67 }
68
69 #---------------------------------------------------------------------
70 ##=item url_rsync_netselect <url>
71 ##
72 ## run netselect on the url, this will also expand and rank when there
73 ## are multiple A records
74 ##
75 #---------------------------------------------------------------------
76 function url_rsync_netselect() {
77 netselect -s 1000 $@ 2>/dev/null
78 }
79
80 #---------------------------------------------------------------------
81 ##=back
82 ##
83 ##=head1 LICENSE
84 ##
85 ## This software is free software; you can redistribute it and/or modify
86 ## it under the terms of the GNU General Public License as published by
87 ## the Free Software Foundation; either version 2 of the License, or
88 ## (at your option) any later version.
89 ##
90 ## This software is distributed in the hope that it will be useful,
91 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
92 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 ## GNU General Public License for more details.
94 ##
95 ## You should have received a copy of the GNU General Public License
96 ## along with this software; if not, write to the Free Software
97 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
98 ##
99 #---------------------------------------------------------------------