[PC-BSD Commits] r13953 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Wed Nov 16 09:22:37 PST 2011


Author: kris
Date: 2011-11-16 09:22:36 -0800 (Wed, 16 Nov 2011)
New Revision: 13953

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:


Add patch from Baptiste to simplify pbi startup



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-16 17:12:28 UTC (rev 13952)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-16 17:22:36 UTC (rev 13953)
@@ -6377,50 +6377,50 @@
 
 	PBI_PUBKEYS="`ls ${PBI_DBKEYDIR}/*.ssl 2>/dev/null`"
 
-	if [ ! -e "${PBI_ETCCONF}" ] ; then return 0 ; fi
+	[ -e "${PBI_ETCCONF}" ] || return 0
 
 	# See if we have a custom index refresh rate
-	_ckPBIIR="`cat ${PBI_ETCCONF} | grep '^PBI_INDEXREFRESH: ' | sed 's|PBI_INDEXREFRESH: ||g'`"
-	if [ ! -z "${_ckPBIIR}" -a $(is_num "$_ckPBIIR") ] ; then 
+	_ckPBIIR="`sed -n 's/^PBI_INDEXREFRESH: //g' ${PBI_ETCCONF}`"
+	if [ -n "${_ckPBIIR}" -a $(is_num "$_ckPBIIR") ] ; then 
 		PBI_INDEXREFRESH="${_ckPBIIR}"
 	fi
 
 	# See if we have a custom pbid refresh time
 	_ckPBID="`cat ${PBI_ETCCONF} | grep '^PBID_REFRESH: ' | sed 's|PBID_REFRESH: ||g'`"
-	if [ ! -z "${_ckPBID}" -a $(is_num "$_ckPBID") ] ; then 
+	if [ -n "${_ckPBID}" -a $(is_num "$_ckPBID") ] ; then 
 		PBIDSLEEP="${_ckPBID}"
 	fi
 
         # Load Proxy Variables
 	if [ -z "$PBI_PROXYURL" -a -e "${PBI_ETCCONF}" ] ; then
-		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'`"
+		PBI_PROXYURL="`sed -n 's/PBI_PROXYURL: //p' ${PBI_ETCCONF}`"
+		PBI_PROXYPORT="`sed -n 's/PBI_PROXYPORT: //p' ${PBI_ETCCONF}`"
+		PBI_PROXYTYPE="`sed -n 's/PBI_PROXYTYPE: //p' ${PBI_ETCCONF}`"
+		PBI_PROXYUSER="`sed -n 's/PBI_PROXYUSER: //p' ${PBI_ETCCONF}`"
+		PBI_PROXYPASS="`sed -n 's/PBI_PROXYPASS: //p' ${PBI_ETCCONF}`"
 	fi
 
 	# If empty proxy config, check if configured for master pcbsd.conf file
 	if [ -z "$PBI_PROXYURL" -a -e "${PCBSD_ETCCONF}" ] ; then
-		PBI_PROXYURL="`cat ${PCBSD_ETCCONF} | grep 'PCBSD_PROXYURL: ' | sed 's|PCBSD_PROXYURL: ||g'`"
-		PBI_PROXYPORT="`cat ${PCBSD_ETCCONF} | grep 'PCBSD_PROXYPORT: ' | sed 's|PCBSD_PROXYPORT: ||g'`"
-		PBI_PROXYTYPE="`cat ${PCBSD_ETCCONF} | grep 'PCBSD_PROXYTYPE: ' | sed 's|PCBSD_PROXYTYPE: ||g'`"
-		PBI_PROXYUSER="`cat ${PCBSD_ETCCONF} | grep 'PCBSD_PROXYUSER: ' | sed 's|PCBSD_PROXYUSER: ||g'`"
-		PBI_PROXYPASS="`cat ${PCBSD_ETCCONF} | grep 'PCBSD_PROXYPASS: ' | sed 's|PCBSD_PROXYPASS: ||g'`"
+		PBI_PROXYURL="`sed -n 's/PBI_PROXYURL: //p' ${PCBSD_ETCCONF}`"
+		PBI_PROXYPORT="`sed -n 's/PBI_PROXYPORT: //p' ${PCBSD_ETCCONF}`"
+		PBI_PROXYTYPE="`sed -n 's/PBI_PROXYTYPE: //p' ${PCBSD_ETCCONF}`"
+		PBI_PROXYUSER="`sed -n 's/PBI_PROXYUSER: //p' ${PCBSD_ETCCONF}`"
+		PBI_PROXYPASS="`sed -n 's/PBI_PROXYPASS: //p' ${PCBSD_ETCCONF}`"
 	fi
 
 
         # Create the PROXY variables based upon proxy information supplied
-	if [ ! -z "$PBI_PROXYURL" ] ; then
-		if [ ! -z "$PBI_PROXYPORT" ] ; then
+	if [ -n "$PBI_PROXYURL" ] ; then
+		if [ -n "$PBI_PROXYPORT" ] ; then
 			HTTP_PROXY="${PBI_PROXYURL}:${PBI_PROXYPORT}"
 			export HTTP_PROXY
 		else
 			HTTP_PROXY="${PBI_PROXYURL}"
 			export HTTP_PROXY
 		fi
-		if [ ! -z "$PBI_PROXYUSER" ] ; then
-			if [ ! -z "$PBI_PROXYPASS" ] ; then
+		if [ -n "$PBI_PROXYUSER" ] ; then
+			if [ -n "$PBI_PROXYPASS" ] ; then
 				HTTP_PROXY_AUTH="basic:*:${PBI_PROXYUSER}:${PBI_PROXYPASS}"
 				export HTTP_PROXY_AUTH
 			fi



More information about the Commits mailing list