1 # mpk-source - downloads source code.
2 # Copyright (C) 2008 Cesar Strauss
4 # This file is part of Minipack - an automated build tool.
6 # Minipack 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 3 of the License, or
9 # (at your option) any later version.
11 # Minipack is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Minipack. If not, see <http://www.gnu.org/licenses/>.
31 : ${source_package_type:=tar.gz}
32 : ${source:=$name-$version.$source_package_type}
33 : ${gnu_mirror:=http://ftp.gnu.org/pub/gnu}
35 if [ -z "$force" -a -e $sourcedir/$source ]; then
39 if [ -n "$origin" ]; then
41 gnu) pkg_download="$gnu_mirror/$name/$source";;
42 sf) pkg_download="http://downloads.sourceforge.net/sourceforge/$name/$source";;
43 *) echo >&2 "$name: Unknown origin."; exit 1;;
47 if [ -n "$download" ]; then
48 pkg_download=$download/$source
51 if [ -z "$pkg_download" ]; then
52 echo >&2 "$name: download location not found."
56 mkdir -p $sourcedir/partial
58 echo Downloading $name from $pkg_download ...
62 echo >&2 "$(basename $0) source: Failed to download $name"
66 mv $sourcedir/partial/$source $sourcedir
70 -f|--force) force=yes; shift;;
71 -*) echo "$(basename $0) source: unrecognized option"; exit 1;;
76 if [ -z "$pkg" ]; then
77 echo "Usage: $(basename $0) source package-name ..."
81 recipe=$(get_recipe_name $pkg) || exit 1