[PC-BSD Commits] r7613 - in pcbsd/current/src-qt4/pbi-manager: . man

svn at pcbsd.org svn at pcbsd.org
Tue Sep 21 12:00:11 PDT 2010


Author: kris
Date: 2010-09-21 12:00:10 -0700 (Tue, 21 Sep 2010)
New Revision: 7613

Modified:
   pcbsd/current/src-qt4/pbi-manager/man/pbi_info.1
   pcbsd/current/src-qt4/pbi-manager/pbi-manager
Log:

Update pbi_info with "-i" flag, which provides listing of PBIs available for download / running in the master index file



Modified: pcbsd/current/src-qt4/pbi-manager/man/pbi_info.1
===================================================================
--- pcbsd/current/src-qt4/pbi-manager/man/pbi_info.1	2010-09-21 18:02:18 UTC (rev 7612)
+++ pcbsd/current/src-qt4/pbi-manager/man/pbi_info.1	2010-09-21 19:00:10 UTC (rev 7613)
@@ -7,6 +7,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl a
+.Op Fl i
 .Op Fl v
 .Op Ar pbi
 .Sh DESCRIPTION
@@ -19,6 +20,8 @@
 .Bl -tag -width indent
 .It Fl a
 List all PBIs installed on the system, same as running pbi_info without an argument. 
+.It Fl i
+List all available PBIS from the master index file
 .It Fl v
 Enable verbose output
 .El

Modified: pcbsd/current/src-qt4/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-qt4/pbi-manager/pbi-manager	2010-09-21 18:02:18 UTC (rev 7612)
+++ pcbsd/current/src-qt4/pbi-manager/pbi-manager	2010-09-21 19:00:10 UTC (rev 7613)
@@ -243,6 +243,8 @@
                 case "$1" in
                 -a)     PBI_INFONAME="--ALL--"
                         ;;
+		-i) 	PBI_INFOINDEX="YES"	
+			;;
                 -v)     PBI_VERBOSE="YES" 
                         ;;
                  *)
@@ -2686,6 +2688,19 @@
 # Display information on the PBI / PBIs
 do_pbi_info() {
 
+	# If we are listing available PBIs via the index file
+	if [ "$PBI_INFOINDEX" = "YES" ] ; then
+		init_tmpdir
+
+		# See if we need to update the PBI index file
+		check_update_index
+		
+		# List the available PBIs from the index
+		do_index_listing
+		
+		exit_trap
+	fi
+
 	if [ "$PBI_INFONAME" = "--ALL--" ] ; then
 		for i in `ls ${PBI_DBDIR}/ 2>/dev/null`
 		do
@@ -2707,6 +2722,32 @@
 	fi
 }
 
+# Read through the master index file and provide listing of available PBIs for installation
+do_index_listing()
+{
+	# Make sure we have a master index
+	if [ ! -e "${PBI_APPDIR}/${PBI_INDEXUPFILE}" ] ; then return ; fi
+
+	echo "Current and available PBIs from master INDEX. * = current"
+	echo "------------------------------------------------------"
+
+	sort "${PBI_APPDIR}/${PBI_INDEXUPFILE}" | while read _iLine
+	do
+	        PBI_UPNAME="`echo $_iLine | cut -d ':' -f 1`"
+	        PBI_UPARCH="`echo $_iLine | cut -d ':' -f 2`"
+	        PBI_UPNVER="`echo $_iLine | cut -d ':' -f 3`"
+        	PBI_UPSTATUS="`echo $_iLine | cut -d ':' -f 9`"
+	
+		if [ "$PBI_UPSTATUS" = "current" ] ; then
+			echo "$PBI_UPNAME	$PBI_UPNVER	$PBI_UPARCH *"
+		fi
+		if [ "$PBI_UPSTATUS" = "active" ] ; then
+			echo "$PBI_UPNAME	$PBI_UPNVER	$PBI_UPARCH"
+		fi
+	done
+
+}
+
 # Checks if we have a custom script to run prior to port make
 run_pbi_preportmake()
 {
@@ -2896,6 +2937,10 @@
 
 # Check if we need to pull down the updated INDEX file
 check_update_index() {
+
+	# If not running as root, don't bother trying to update
+	if [ `id -u` != "0" ] ; then return ; fi
+
 	_ufbsdver="`uname -r`"
 
 	# Init the tmpdir



More information about the Commits mailing list