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

svn at pcbsd.org svn at pcbsd.org
Wed Dec 8 07:19:46 PST 2010


Author: kris
Date: 2010-12-08 07:19:46 -0800 (Wed, 08 Dec 2010)
New Revision: 8168

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

Fix up archive function for old PBI versions



Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-12-07 22:39:30 UTC (rev 8167)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2010-12-08 15:19:46 UTC (rev 8168)
@@ -4200,10 +4200,10 @@
 
 	# Move old PBIs to archived folder
 	get_pbi_progversion
-        oldVersion=`cat ${PBI_AB_OUTDIR}/${_cd}/pbi-version 2>/dev/null`
+        oldVersion=`cat ${_od}/pbi-version 2>/dev/null`
 	if [ "$oldVersion" != "$PBI_PROGVERSION" ]; then
 		echo "Archiving old PBIs..."
-		archive_old_pbis "$_od" "$PBI_AB_ARCHIVENUM"
+		archive_old_pbis "${_od}" "$PBI_AB_ARCHIVENUM"
 	fi
 
 	# Add some header info to log file
@@ -4597,15 +4597,20 @@
 # Move old PBIs to the archive
 archive_old_pbis()
 {
-	_od="$1"
-	_keepnum="$2"
+	local _od="$1"
+	local _keepnum="$2"
 
 	# Make sure the archived dir exists
 	if [ ! -d "${_od}/archived" ] ; then mkdir "${_od}/archived"; fi
 
-	mv "${_od}/*.pbi" "${_od}/archived" >/dev/null 2>/dev/null
-	mv "${_od}/*.sha256" "${_od}/archived" >/dev/null 2>/dev/null 
+	# Make sure we have PBIs to archive
+	ls "${_od}/*.pbi" >/dev/null 2>/dev/null
+        if [ "$?" != "0" ] ; then return ; fi
 
+	echo "Moving old PBIs from ${_od}/*.pbi -> ${_od}/archived/"
+	mv ${_od}/*.pbi ${_od}/archived/
+	mv ${_od}/*.sha256 ${_od}/archived/
+
 	# Prune anything beyond the _keepnum
 	oCount="0"
 	oFiles=`ls -t ${_od}/archived/*.pbi 2>/dev/null`



More information about the Commits mailing list