[PC-BSD Commits] r7587 - pcbsd/current/src-qt4/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Fri Sep 17 07:03:02 PDT 2010


Author: kris
Date: 2010-09-17 07:03:01 -0700 (Fri, 17 Sep 2010)
New Revision: 7587

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

Cleanup /tmp usage, stick to PBI_TMPDIR, so we can be sure to not leave stragglers after execution



Modified: pcbsd/current/src-qt4/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-qt4/pbi-manager/pbi-manager	2010-09-17 09:04:16 UTC (rev 7586)
+++ pcbsd/current/src-qt4/pbi-manager/pbi-manager	2010-09-17 14:03:01 UTC (rev 7587)
@@ -920,6 +920,7 @@
 # Star the make patch process
 pbi_makepatch_init() {
   	require_root
+	init_tmpdir
 	parse_makepatch_pbi_cmdline "$@"
 
 	# Create a new patch file from the two PBIs specified
@@ -929,6 +930,7 @@
 # Start the patch process
 pbi_patch_init() {
   	require_root
+	init_tmpdir
 	parse_patch_pbi_cmdline "$@"
 
 	# Check if we are only displaying information
@@ -1029,7 +1031,7 @@
 patch_merge_bsdiffs()
 {
 	echo "Applying patch data..."
-	find ${PBI_EXTRACTDIR} | grep '.bsdiff' | sed "s|${PBI_EXTRACTDIR}/||g" > /tmp/.PBI.bspatch.$$
+	find ${PBI_EXTRACTDIR} | grep '.bsdiff' | sed "s|${PBI_EXTRACTDIR}/||g" > ${PBI_TMPDIR}/.PBI.bspatch.$$
 
 	while read pLine
 	do
@@ -1079,9 +1081,9 @@
 		# Remove the old file
 		rm "${PBI_PATCHWRKDIR}/${_tFile}.patch.$$"
 
-	done < "/tmp/.PBI.bspatch.$$"
+	done < "${PBI_TMPDIR}/.PBI.bspatch.$$"
 
-	rm /tmp/.PBI.bspatch.$$
+	rm "${PBI_TMPDIR}/.PBI.bspatch.$$"
 }
 
 # Function which does the new file extraction for this PBI
@@ -1162,6 +1164,7 @@
 
 # Start the pbi_add process
 pbi_add_init() {
+	init_tmpdir
 	parse_add_pbi_cmdline "$@"
 
 
@@ -3210,7 +3213,7 @@
 	# Make the header file
 	if [ -e "$_pbiPatchHeaderDir" ] ; then rm -rf "$_pbiPatchHeaderDir"; fi
 	mkdir -p "$_pbiPatchHeaderDir"
-	open_header_tmp "/tmp/"
+	open_header_tmp "${PBI_TMPDIR}"
   	cp ${PBI_HEADER_TMPDIR}/* "$_pbiPatchHeaderDir/"
 
 	# Remove any signatures
@@ -3262,10 +3265,10 @@
 # Function which compares two directories, and returns a list of chmod commands to get them in line
 gen_chmod_list() {
 
-	_chList="/tmp/.pbi.chList.$$"
+	_chList="${PBI_TMPDIR}/.pbi.chList.$$"
 	if [ -e "$_chList" ] ; then rm "$_chList" ; fi
 
-	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >/tmp/.pbi.nDir.$$
+	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >${PBI_TMPDIR}/.pbi.nDir.$$
 
 	echo "Getting permissions of changed files..."
 
@@ -3291,10 +3294,10 @@
 			echo "chmod $_newPerm $line" >> $_chList
 		fi
 
-	done < /tmp/.pbi.nDir.$$
+	done < ${PBI_TMPDIR}/.pbi.nDir.$$
 
 	# Remove the tmp list files
-	rm /tmp/.pbi.nDir.$$
+	rm ${PBI_TMPDIR}/.pbi.nDir.$$
 
 	if [ -e "$_chList" ] ; then
 		VAL="$_chList"
@@ -3308,7 +3311,7 @@
 # Function which compares two directories, and returns a list of files / dirs removed in the new dir
 gen_bsdiffs_dirs() {
 
-	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >/tmp/.pbi.nDir.$$
+	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >${PBI_TMPDIR}/.pbi.nDir.$$
 
 	echo "Getting bsdiffs of changed files..."
 
@@ -3345,37 +3348,37 @@
 			sha256 -q "${2}/${line}" > "${_tDir}/${_bName}.sha256"
 		fi
 
-	done < /tmp/.pbi.nDir.$$
+	done < ${PBI_TMPDIR}/.pbi.nDir.$$
 
 	# Remove the tmp list files
-	rm /tmp/.pbi.nDir.$$
+	rm ${PBI_TMPDIR}/.pbi.nDir.$$
 }
 
 # Function which compares two directories, and returns a list of files / dirs removed in the new dir
 gen_rem_list() {
 
-	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >/tmp/.pbi.nDir.$$
-	find ${2} | sed "s|^${2}/||g" | sed "s|^${2}||g" >/tmp/.pbi.oDir.$$
+	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >${PBI_TMPDIR}/.pbi.nDir.$$
+	find ${2} | sed "s|^${2}/||g" | sed "s|^${2}||g" >${PBI_TMPDIR}/.pbi.oDir.$$
 
 	echo "Finding removed files..."
 
-	_rmList="/tmp/.pbi.rmList.$$"
+	_rmList="${PBI_TMPDIR}/.pbi.rmList.$$"
 	if [ -e "$_rmList" ] ; then rm "$_rmList" ; fi
 
 	while read line
 	do
 		if [ -z "$line" ] ; then continue ; fi
-		grep "^$line" /tmp/.pbi.nDir.$$ >/dev/null 2>/dev/null
+		grep "^$line" ${PBI_TMPDIR}/.pbi.nDir.$$ >/dev/null 2>/dev/null
 		if [ "$?" != "0" ] ; then
 			#echo "Removed File: $line"
 			echo "$line" >> ${_rmList}
 		fi
 
-	done < /tmp/.pbi.oDir.$$
+	done < ${PBI_TMPDIR}/.pbi.oDir.$$
 
 	# Remove the tmp list files
-	rm /tmp/.pbi.nDir.$$
-	rm /tmp/.pbi.oDir.$$
+	rm ${PBI_TMPDIR}/.pbi.nDir.$$
+	rm ${PBI_TMPDIR}/.pbi.oDir.$$
 
 	if [ -e "$_rmList" ] ; then
 		VAL="$_rmList"
@@ -3387,29 +3390,29 @@
 # Function which compares two directories, and returns a list of files / dirs added in the new dir
 gen_newfile_list() {
 
-	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >/tmp/.pbi.nDir.$$
-	find ${2} | sed "s|^${2}/||g" | sed "s|^${2}||g" >/tmp/.pbi.oDir.$$
+	find ${1} | sed "s|^${1}/||g" | sed "s|^${1}||g" >${PBI_TMPDIR}/.pbi.nDir.$$
+	find ${2} | sed "s|^${2}/||g" | sed "s|^${2}||g" >${PBI_TMPDIR}/.pbi.oDir.$$
 
 	echo "Finding new files..."
 
-	_addList="/tmp/.pbi.addList.$$"
+	_addList="${PBI_TMPDIR}/.pbi.addList.$$"
 	if [ -e "$_addList" ] ; then rm "$_addList" ; fi
 
 	while read line
 	do
 		# Search for all new files + symlinks to include in tarball
 		if [ -z "$line" ] ; then continue ; fi
-		grep "^$line" /tmp/.pbi.oDir.$$ >/dev/null 2>/dev/null
+		grep "^$line" ${PBI_TMPDIR}/.pbi.oDir.$$ >/dev/null 2>/dev/null
 		if [ "$?" != "0" -o -L "${1}/$line" ] ; then
 			#echo "New File: $line"
 			echo "./$line" >> ${_addList}
 		fi
 
-	done < /tmp/.pbi.nDir.$$
+	done < ${PBI_TMPDIR}/.pbi.nDir.$$
 
 	# Remove the tmp list files
-	rm /tmp/.pbi.nDir.$$
-	rm /tmp/.pbi.oDir.$$
+	rm ${PBI_TMPDIR}/.pbi.nDir.$$
+	rm ${PBI_TMPDIR}/.pbi.oDir.$$
 
 	if [ -e "$_addList" ] ; then
 		VAL="$_addList"



More information about the Commits mailing list