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

svn at pcbsd.org svn at pcbsd.org
Mon Aug 2 14:55:25 PDT 2010


Author: kris
Date: 2010-08-02 14:55:25 -0700 (Mon, 02 Aug 2010)
New Revision: 7332

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

Updated pbi-manager, added some keyword tags to verbose output for the GUI to watch for, also move binary wrappers back to .sbin, keep original binaries in same location



Modified: pcbsd-projects/pbi-manager/pbi-manager
===================================================================
--- pcbsd-projects/pbi-manager/pbi-manager	2010-08-02 21:23:13 UTC (rev 7331)
+++ pcbsd-projects/pbi-manager/pbi-manager	2010-08-02 21:55:25 UTC (rev 7332)
@@ -1260,6 +1260,8 @@
 	
 	if [ "$err" != "0" ] ; then exit_err "Failed extracting ${PBI_FILENAME}" ; fi
 
+	if [ "$PBI_VERBOSE" = "YES" ] ; then echo "Extraction Finished!" ; fi
+
 	# If this is an extract only, do it and exit
 	if [ "${PBI_EXTRACTONLY}" = "YES" ] ; then exit 0 ; fi
 }
@@ -1454,32 +1456,25 @@
         if [ ! -d "${dir}" ] ; then mkdir -p "${dir}" ; fi
 
 	bin="${1}"
-	binname="`basename ${bin}`"
+	fbin="`basename ${bin}`"
 	tar="${2}"
 	ch="${3}"
 	onlywrap="${4}"
 
-	# Set the real binary dir for the original binaries
-	rbindir="`dirname $bin`.rbin"
-	if [ ! -d "${PBI_STAGEDIR}/${rbindir}" ] ; then mkdir -p "${PBI_STAGEDIR}/${rbindir}" ; fi
-
-	# Move the orignal binary to the rbindir
-	mv "${PBI_STAGEDIR}/${bin}" "${PBI_STAGEDIR}/${rbindir}/"
-	
 	# Save the wrapper location so we know what files to modify at install time
-	MOD_FILES_PREFIX="${bin} ${MOD_FILES_PREFIX}"
-	MOD_WRAPPERS="${bin} ${MOD_WRAPPERS}"
+	MOD_FILES_PREFIX="${fbin} ${MOD_FILES_PREFIX}"
+	MOD_WRAPPERS="${fbin} ${MOD_WRAPPERS}"
 
 	# 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}" \
+		echo "ln -fs \$PBI_PROGDIRPATH/${PBI_FAKEBIN_DIR}/${fbin} \$SYS_LOCALBASE/${tar}" \
 			>> "${dir}/${PBI_INS_PATHSCRIPT}"
 	fi
 
 	# Start making the wrapper script
-	echo "#!/bin/sh" > ${PBI_STAGEDIR}/${bin}
-	echo "PROGDIR=\"%%PBI_APPDIR%%\" ; export PROGDIR" >>${PBI_STAGEDIR}/${bin}
-	echo "PROGBIN=\"${rbindir}/${binname}\" ; export PROGBIN" >>${PBI_STAGEDIR}/${bin}
+	echo "#!/bin/sh" > ${PBI_STAGEDIR}/${fbin}
+	echo "PROGDIR=\"%%PBI_APPDIR%%\" ; export PROGDIR" >>${PBI_STAGEDIR}/${fbin}
+	echo "PROGBIN=\"${bin}\" ; export PROGBIN" >>${PBI_STAGEDIR}/${fbin}
 
 	# Start the main code block
 	echo 'PATH="${PROGDIR}/bin:${PROGDIR}/sbin:${PROGDIR}/libexec:$PATH"; export PATH
@@ -1516,7 +1511,7 @@
 LD_32_LIBRARY_PATH="${LDCONFIGDIRS}:${PROGDIR}/lib/:${PROGDIR}/kde4/lib:${PROGDIR}/lib/qt4"
 export LD_LIBRARY_PATH LD_32_LIBRARY_PATH
 
-'>>${PBI_STAGEDIR}/${bin}
+'>>${PBI_STAGEDIR}/${fbin}
 
 	# See if we need the crash-handler
 	if [ "$ch" = "YES" ] ; then
@@ -1527,10 +1522,10 @@
 | tee $STDLOG) 3>&1 1>&2 2>&3 | tee $STELOG) 3>&1 1>&2 2>&3)
 
 rm $STDLOG >/dev/null 2>/dev/null
-rm $STELOG >/dev/null 2>/dev/null' >>${PBI_STAGEDIR}/${bin}
+rm $STELOG >/dev/null 2>/dev/null' >>${PBI_STAGEDIR}/${fbin}
 
 	else
-		echo '${PROGDIR}/${PROGBIN}  "$@"' >>${PBI_STAGEDIR}/${bin}
+		echo '${PROGDIR}/${PROGBIN}  "$@"' >>${PBI_STAGEDIR}/${fbin}
 	fi		
 }
 
@@ -1669,7 +1664,7 @@
 	echo 'cd $PBI_PROGDIRPATH' >> "$insc"
 	echo "for i in \$MOD_FILES_PREFIX" >> "$insc"
 	echo "do" >> "$insc"
-	echo "  sed -i.bak \"s|%%PBI_EXEDIR%%|\$PBI_PROGDIRPATH/\$PBI_WRAPPERBIN|g\" \$i" >> "$insc"
+	echo "  sed -i.bak \"s|%%PBI_EXEDIR%%|\$PBI_PROGDIRPATH/\$PBI_FAKEBIN_DIR|g\" \$i" >> "$insc"
 	echo "  sed -i.bak \"s|%%PBI_APPDIR%%|\$PBI_PROGDIRPATH|g\" \$i" >> "$insc"
 	echo "  rm \$i.bak" >> "$insc"
 	echo "done" >> "$insc"
@@ -2731,20 +2726,27 @@
 			if [ "$?" != "0" ]; then continue ; fi
 
 			# Check if this is a .service or .xml file
-		 	if echo "${_dsd}/$_dbfile" | grep ".service" >/dev/null 2>/dev/null ; then
+		 	echo "${_dsd}/$_dbfile" | grep ".service" >/dev/null 2>/dev/null
+			if [ "$?" = "0" ] ; then
 				dbext=".service"
 
 				# We have a service file, find the target binary and make sure its added as a wrapper only
-				_dbbin="`cat ${_dsd}/${_dbfile} | grep 'Exec' | cut -d '=' -f 2`"
+				_dbbin="`grep 'Exec' ${PBI_PROGDIRPATH}/${_dsd}/${_dbfile} | cut -d '=' -f 2`"
 				_dbbin=`echo $_dbbin | sed "s|${PBI_PROGDIRPATH}/||g"`
 				if [ ! -z "$_dbbin" ] ; then
 				echo "${_dbbin}		${_dbbin}	binwrapper" >> "$_ef"
 				fi
+
+				# Massage the service file to point to the fakebin wrapper
+				rmBaseDir="`dirname ${PBI_PROGDIRPATH}/${dbusdir}/${_dbfile}`"
+	                        sed -i.bak "s|${rmBaseDir}/|${PBI_PROGDIRPATH}/${PBI_FAKEBIN_DIR}/|g" "${PBI_PROGDIRPATH}/${_dsd}/${_dbfile}"
+	                        rm "${PBI_PROGDIRPATH}/${_dsd}/${_dbfile}.bak"
+				
 			else
 				dbext=".xml"
 			fi
 
-			echo "${_dsd}/${_dbfile}	${_dsd}/${_dbfile}.${_pname}.${dbext}	replace" >> "$_ef"
+			echo "${dbusdir}/${_dbfile}	${dbusdir}/${_dbfile}.${_pname}.${dbext}	replace" >> "$_ef"
 		done < ${PBI_TMPDIR}/.dbus.$$
 		rm ${PBI_TMPDIR}/.dbus.$$
 



More information about the Commits mailing list