1 # mpk-source - downloads source code
2 # This file is part of Minipack - an automated build tool.
4 # Copyright (C) 2008 Cesar Strauss
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 : ${source_package_type:=tar.gz}
28 : ${source:=$name-$version.$source_package_type}
30 if [ -z "$force" -a -e $sourcedir/$source ]; then
34 if [ -n "$origin" ]; then
36 gnu) pkg_download="http://ftp.gnu.org/pub/gnu/$name/$source";;
37 sf) pkg_download="http://downloads.sourceforge.net/sourceforge/$name/$source";;
38 *) echo >&2 "$name: Unknown origin."; exit 1;;
42 if [ -n "$download" ]; then
43 pkg_download=$download/$source
46 if [ -z "$pkg_download" ]; then
47 echo >&2 "$name: download location not found."
51 mkdir -p $sourcedir/partial
53 echo Downloading $name from $pkg_download ...
57 echo >&2 "$(basename $0) source: Failed to download $name"
61 mv $sourcedir/partial/$source $sourcedir
65 -f|--force) force=yes; shift;;
66 -*) echo "$(basename $0) source: unrecognized option"; exit 1;;
71 if [ -z "$pkg" ]; then
72 echo "Usage: $(basename $0) source package-name ..."
76 recipe=$(get_recipe_name $pkg) || exit 1