xref: /minix3/external/lgpl3/mpc/fetch.sh (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
184d9c625SLionel Sambuc#!/bin/sh
284d9c625SLionel Sambuc
384d9c625SLionel Sambuc# Make sure we're in our directory (i.e., where this shell script is)
484d9c625SLionel Sambucecho $0
584d9c625SLionel Sambuccd `dirname $0`
684d9c625SLionel Sambuc
784d9c625SLionel Sambuc# Configure fetch method
8*0a6a1f1dSLionel SambucURL="http://www.minix3.org/pkgsrc/distfiles/minix/3.4.0/mpc-1.0.1.tar.gz"
984d9c625SLionel SambucBACKUP_URL="http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz"
1029b8e5ffSLionel SambucFETCH=ftp
1184d9c625SLionel Sambucwhich curl >/dev/null
1284d9c625SLionel Sambucif [ $? -eq 0 ]; then
1384d9c625SLionel Sambuc	FETCH="curl -O -f"
1484d9c625SLionel Sambucfi
1584d9c625SLionel Sambuc
1684d9c625SLionel Sambuc# Fetch sources if not available
1784d9c625SLionel Sambucif [ ! -d dist ];
1884d9c625SLionel Sambucthen
1984d9c625SLionel Sambuc        if [ ! -f mpc-1.0.1.tar.gz ]; then
2084d9c625SLionel Sambuc		$FETCH $URL
2184d9c625SLionel Sambuc		if [ $? -ne 0 ]; then
2284d9c625SLionel Sambuc			$FETCH $BACKUP_URL
2384d9c625SLionel Sambuc		fi
2484d9c625SLionel Sambuc	fi
2584d9c625SLionel Sambuc
2684d9c625SLionel Sambuc	tar -oxzf mpc-1.0.1.tar.gz
2784d9c625SLionel Sambuc	mv mpc-1.0.1 dist
2884d9c625SLionel Sambucfi
2984d9c625SLionel Sambuc
30