[PC-BSD Commits] r7393 - pcbsd-projects/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Wed Aug 18 06:35:23 PDT 2010


Author: kris
Date: 2010-08-18 06:35:23 -0700 (Wed, 18 Aug 2010)
New Revision: 7393

Modified:
   pcbsd-projects/pbi-manager/pbi-manager
Log:

Added additional socks / proxy support to pbi-manager when using curl to fetch remote files



Modified: pcbsd-projects/pbi-manager/pbi-manager
===================================================================
--- pcbsd-projects/pbi-manager/pbi-manager	2010-08-17 20:45:13 UTC (rev 7392)
+++ pcbsd-projects/pbi-manager/pbi-manager	2010-08-18 13:35:23 UTC (rev 7393)
@@ -2797,14 +2797,34 @@
 	if [ ! -e "${PBI_ETCCONF}" ] ; then return 0 ; fi
 	PBI_UPDATEURL="`cat ${PBI_ETCCONF} | grep 'PBI_UPDATEURL: ' | sed 's|PBI_UPDATEURL: ||g'`"
 	PBI_PUBKEYS="`cat ${PBI_ETCCONF} | grep 'PBI_PUBKEYS: ' | sed 's|PBI_PUBKEYS: ||g'`"
+
+        # Set the default remote mirror we are using
 	PBI_MIRROR="`cat ${PBI_ETCCONF} | grep 'PBI_MIRROR: ' | sed 's|PBI_MIRROR: ||g'`"
+
+        # Load Proxy Variables
 	PBI_PROXYURL="`cat ${PBI_ETCCONF} | grep 'PBI_PROXYURL: ' | sed 's|PBI_PROXYURL: ||g'`"
 	PBI_PROXYPORT="`cat ${PBI_ETCCONF} | grep 'PBI_PROXYPORT: ' | sed 's|PBI_PROXYPORT: ||g'`"
+	PBI_PROXYTYPE="`cat ${PBI_ETCCONF} | grep 'PBI_PROXYTYPE: ' | sed 's|PBI_PROXYTYPE: ||g'`"
+	PBI_PROXYUSER="`cat ${PBI_ETCCONF} | grep 'PBI_PROXYUSER: ' | sed 's|PBI_PROXYUSER: ||g'`"
+	PBI_PROXYPASS="`cat ${PBI_ETCCONF} | grep 'PBI_PROXYPASS: ' | sed 's|PBI_PROXYPASS: ||g'`"
+
+        # Create the PBI_CURLPROXY variable based upon proxy information supplied
 	if [ ! -z "$PBI_PROXYURL" ] ; then
-		PBI_CURLPROXY="--proxy ${PBI_PROXYPORT}"
+		if [ "$PBI_PROXYTYPE" = "SOCKS5" ] ; then
+		  	PBI_CURLPROXY="--proxy-anyauth --socks5 ${PBI_PROXYURL}"
+		else
+		  	PBI_CURLPROXY="--proxy-anyauth --proxy ${PBI_PROXYURL}"
+		fi
 		if [ ! -z "$PBI_PROXYPORT" ] ; then
 			PBI_CURLPROXY="${PBI_CURLPROXY}:${PBI_PROXYPORT}"
 		fi
+		if [ !-z "$PBI_PROXYUSER" ] ; then
+			if [ ! -z "$PBI_PROXYPASS" ] ; then
+				PBI_CURLPROXY="${PBI_CURLPROXY} --proxy-user ${PBI_PROXYUSER}:${PBI_PROXYPASS}"
+			else
+				PBI_CURLPROXY="${PBI_CURLPROXY} --proxy-user ${PBI_PROXYUSER}"
+			fi
+		fi
 	else
 		PBI_CURLPROXY=""
 	fi



More information about the Commits mailing list