--- makepkg.orig	2006-02-03 09:40:57.000000000 +1000
+++ makepkg	2006-05-13 10:54:09.000000000 +1100
@@ -474,13 +474,33 @@
 			exit 1
 		fi
 		proto=`echo $netfile | sed 's|://.*||'`
-		if [ "$proto" != "ftp" -a "$proto" != "http" -a "$proto" != "https" ]; then
+		if [ "$proto" != "ftp" -a "$proto" != "http" -a "$proto" != "https" -a "$proto" != "rsync" ]; then
 			error "$netfile was not found in the build directory and is not a proper URL."
 			msg "Aborting..."
 			exit 1
 		fi
+		if [ "$proto" = "rsync" ]; then
+		    # check for a rsync utility
+		    if [ -z "$RSYNCAGENT" ]; then
+			    error "RSYNCAGENT is not configured. Check the /etc/makepkg.conf file."
+			    msg "Aborting..."
+			    exit 1
+		    fi
+		    rsyncclient=`echo $RSYNCAGENT | awk {'print $1'}`
+		    if [ ! -x $rsyncclient ]; then
+			    error "rsyncclient `basename $rsyncclient` is not installed."
+			    msg "Aborting..."
+			    exit 1
+		    fi    
+		fi
+
 		msg "    Downloading $file"
-		$FTPAGENT $netfile 2>&1
+		if [ "$proto" = "rsync" ]; then
+		    $RSYNCAGENT $netfile ./ 2>&1
+		else
+		    $FTPAGENT $netfile 2>&1
+		fi
+
 		if [ ! -f $file ]; then
 			error "Failed to download $file"
 			msg "Aborting..."
