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

svn at pcbsd.org svn at pcbsd.org
Fri Jul 2 08:14:29 PDT 2010


Author: kris
Date: 2010-07-02 08:14:29 -0700 (Fri, 02 Jul 2010)
New Revision: 7104

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

Large update to the new pbi-manager, make it dbus aware, able to enable services / make links / wrappers for
dbus related applications



Modified: pcbsd-projects/pbi-manager/pbi-manager
===================================================================
--- pcbsd-projects/pbi-manager/pbi-manager	2010-07-02 09:04:31 UTC (rev 7103)
+++ pcbsd-projects/pbi-manager/pbi-manager	2010-07-02 15:14:29 UTC (rev 7104)
@@ -496,6 +496,9 @@
 	# What dirs do we build hash-lists of
 	HASH_SEARCH_DIRS="info include man lib share kde4/include kde4/lib kde4/share"
 
+	# What dbus dirs do we parse for setting up services
+	DBUS_SEARCH_DIRS="share/dbus-1 kde4/share/dbus-1 gnome/share/dbus-1"
+
 	# Don't modify unless you know what your doing!
 	MOD_PREINS="pre-install.sh"
 	MOD_POSTINS="post-install.sh"
@@ -1367,6 +1370,7 @@
         while read line
         do
 		_bin="NO"
+		_wraponly="NO"
 		_crashhandle="YES"
 		_keep="YES"
                 echo $line | tr '\t' ' ' | tr -s ' ' | grep "^#" >/dev/null 2>/dev/null
@@ -1386,6 +1390,7 @@
   			do
 				case ${i} in
 					binary) _bin="YES" ;;
+	  			    binwrapper) _bin="YES" ; _wraponly="YES" ;;
 				       nocrash) _crashhandle="NO" ;;
 				          keep) _keep="YES" ;;
 				       replace) _keep="NO" ;;
@@ -1402,8 +1407,16 @@
 
 			# If we are doing a binary, run special function to make wrapper
 			if [ "$_bin" = "YES" ] ; then
+
+				# Make sure we don't create any duplicates
+				echo "$_donewrap" | grep "#${src}#" >/dev/null 2>/dev/null
+				if [ "$?" = "0" ] ; then continue ; fi
+				
 				# Make the binary wrapper
-				mk_path_wrappers "$src" "$tar" "$_crashhandle"
+				mk_path_wrappers "$src" "$tar" "$_crashhandle" "$_wraponly"
+
+				# This binary is done, save it now so we don't duplicate later
+				_donewrap="$_donewrap #${src}#"
 			else
 				# Make our link commands
 				if [ "$_keep" = "YES" ] ; then _lop="-fs"; else _lop="-s"; fi
@@ -1442,6 +1455,7 @@
 	binname="`basename ${bin}`"
 	tar="${2}"
 	ch="${3}"
+	onlywrap="${4}"
 
 	# Set the real binary dir for the original binaries
 	rbindir="`dirname $bin`.rbin"
@@ -1454,9 +1468,11 @@
 	MOD_FILES_PREFIX="${bin} ${MOD_FILES_PREFIX}"
 	MOD_WRAPPERS="${bin} ${MOD_WRAPPERS}"
 
-	# Make our link scripts
-	echo "ln -fs \$PBI_PROGDIRPATH/${bin} \$SYS_LOCALBASE/${tar}" \
-		>> "${dir}/${PBI_INS_PATHSCRIPT}"
+	# Make our link to the system localbase if its not a wrapper only
+ 	if [ "$onlywrap" != "YES" ] ; then	
+		echo "ln -fs \$PBI_PROGDIRPATH/${bin} \$SYS_LOCALBASE/${tar}" \
+			>> "${dir}/${PBI_INS_PATHSCRIPT}"
+	fi
 
 	# Start making the wrapper script
 	echo "#!/bin/sh" > ${PBI_STAGEDIR}/${bin}
@@ -2684,6 +2700,41 @@
 		fi
 	done < ${PBI_TMPDIR}/.pkg_flist.$$
 	rm "${PBI_TMPDIR}/.pkg_flist.$$"
+
+	# Now figure out any dbus services we need to make links / wrappers for
+ 	for _dsd in $DBUS_SEARCH_DIRS
+	do
+		# Check if we have a valid dbus directory
+		if [ ! -d "${PBI_PROGDIRPATH}/${_dsd}" ] ; then continue ; fi
+
+		# Make a list of files to include
+		find ${PBI_PROGDIRPATH}/${_dsd} -type f | sed "s|${PBI_PROGDIRPATH}/${_dsd}/||g" > ${PBI_TMPDIR}/.dbus.$$
+		
+		# Add these files to the external links file
+		while read _dbfile
+		do
+			# Get the file extension, only .xml and .service are valid
+			echo "$_dbfile" | grep -e ".xml" -e ".service" >/dev/null 2>/dev/null
+			if [ "$?" != "0" ]; then continue ; fi
+
+			# Check if this is a .service or .xml file
+		 	if echo "$_dbfile" | grep ".service" >/dev/null 2>/dev/null ; then
+				dbext=".service"
+
+				# We have a service file, find the target binary and make sure its added as a wrapper only
+				dbbin="`cat ${_dbfile} | grep 'Exec' | cut -d '=' -f 2`"
+				echo "${_dbbin}		${_dbbin}	binwrapper" >> "$_ef"
+			else
+				dbext=".xml"
+			fi
+
+			echo "${_dbfile}	${_dbfile}.${_pname}.${dbext}	replace" >> "$_ef"
+		done < ${PBI_TMPDIR}/.dbus.$$
+		rm ${PBI_TMPDIR}/.dbus.$$
+
+	done	
+
+	
 }
 
 # Init the crash handler routine



More information about the Commits mailing list