2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: bin/sde-download-get
6 # Copyright (C) 2007 The OpenSDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- SDE-COPYRIGHT-NOTE-END ---
17 export SDEROOT
=$
( cd "${0%/*}/.."; pwd -P )
19 .
$SDEROOT/lib
/libsde.
in
22 local progname
=${0##*/}
24 Usage: $progname [-vqd] <target> <source>
29 longopts
='dry-run,quiet,verbose'
30 options
=$
( getopt
-o "$shortopts" -l "$longopts" -- "$@" )
37 # load new arguments list
38 eval set -- "$options"
45 while [ $# -gt 0 ]; do
59 # now take the real arguments
61 echo_error
"Not enough arguments given."
70 [ $verbose -le 1 ] || echo_info
"($protocol) $@"
72 # find the right handler
73 if [ -x "$SDEROOT/bin/sde-download-$protocol" ]; then
74 handler
="$SDEROOT/bin/sde-download-$protocol"
76 handler
=$
( grep -l "^#Protocol: $protocol\$" "$SDEROOT/bin"/sde-download-
* 2> /dev
/null
)
80 [ -x "$handler" ] || echo_abort
2 "$protocol: protocol unhandled"
82 if [ -n "$dryrun" ]; then
83 echo "(${handler##*/}) $source"
84 elif [ ! -e "$target.lock" ]; then
86 # arguments for the handler, reduce the verbosity on one level
87 if [ $verbose -gt 2 ]; then
89 elif [ $verbose -lt 0 ]; then
93 exec "$handler" $handleropt -- "$target" "$@"