Update soundtest
[grml-scripts.git] / usr_bin / getsf
1 #!/bin/sh
2 # Filename:      getsf
3 # Purpose:       download project from sourceforge.net
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 # Latest change: Fre Sep 29 13:56:15 CEST 2006 [mika]
8 ################################################################################
9
10 if ! type wget 1>&/dev/null 2>&1 ; then
11    echo "Binary wget not available. Exiting." 1>&2
12    exit 1
13 fi
14
15 if [ -z "$1" ] ; then
16    echo "$0 - download project from sourceforge.net" 1>&2
17    echo 1>&2
18    echo "Usage: $0 <projectname-version.archive>" 1>&2
19
20    echo 1>&2 "
21 Usage examples:
22
23   $0 htop-0.6.3.tar.gz
24   $0 http://prdownloads.sourceforge.net/htop/htop-0.6.3.tar.gz
25   MIRROR=puzzle $0 http://prdownloads.sourceforge.net/htop/htop-0.6.3.tar.gz
26
27 Available mirrors:
28
29   superb-east (US), jaist (JP), ovh (FR), optusnet (AU), kent (UK), mesh (DE),
30   superb-west (US), easynews (US), surfnet (NL), ufpr (BR), heanet (IE),
31   nchc (TW), umn (US), belnet (BE), puzzle (CH), switch (CH)
32
33 Send bug reports to Michael Prokop <mika@grml.org>"
34    exit 1
35 fi
36
37 [ -n "$MIRROR" ] || MIRROR=mesh # set default mirror if not already set
38
39 case "$PROG" in
40   *http://*)
41       PROG=${PROG##*/}
42       BASENAME=${PROG%%-*}
43       BASENAME=${BASENAME%%_*}
44       BASENAME=$(echo $BASENAME| tr 'A-Z' 'a-z')
45       wget http://$MIRROR.dl.sourceforge.net/sourceforge/$BASENAME/$PROG
46       ;;
47   *)
48       PROG="$1"
49       BASENAME=${PROG%%-*}
50       BASENAME=${BASENAME%%_*}
51       BASENAME=$(echo $BASENAME| tr 'A-Z' 'a-z')
52       wget http://$MIRROR.dl.sourceforge.net/sourceforge/$BASENAME/$PROG
53       ;;
54 esac
55
56 ## END OF FILE #################################################################