svn commit: r214839 - stable/8/usr.sbin/freebsd-update

Jaakko Heinonen jh at FreeBSD.org
Fri Nov 5 16:04:10 UTC 2010


Author: jh
Date: Fri Nov  5 16:04:10 2010
New Revision: 214839
URL: http://svn.freebsd.org/changeset/base/214839

Log:
  MFC r212505:
  
  In backup_kernel(), support backing up subdirectories and handle files
  with spaces correctly.

Modified:
  stable/8/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/8/usr.sbin/freebsd-update/   (props changed)

Modified: stable/8/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- stable/8/usr.sbin/freebsd-update/freebsd-update.sh	Fri Nov  5 13:46:58 2010	(r214838)
+++ stable/8/usr.sbin/freebsd-update/freebsd-update.sh	Fri Nov  5 16:04:10 2010	(r214839)
@@ -2619,11 +2619,13 @@ backup_kernel () {
 	# "not ours", backup_kernel_finddir would have exited, so
 	# deleting the directory content is as safe as we can make it.
 	if [ -d $BACKUPKERNELDIR ]; then
-		rm -f $BACKUPKERNELDIR/*
+		rm -fr $BACKUPKERNELDIR
 	fi
 
-	# Create directory for backup if it doesn't exist.
+	# Create directories for backup.
 	mkdir -p $BACKUPKERNELDIR
+	mtree -cdn -p "${KERNELDIR}" | \
+	    mtree -Ue -p "${BACKUPKERNELDIR}" > /dev/null
 
 	# Mark the directory as having been created by freebsd-update.
 	touch $BACKUPKERNELDIR/.freebsd-update
@@ -2644,9 +2646,8 @@ backup_kernel () {
 	fi
 
 	# Backup all the kernel files using hardlinks.
-	find $KERNELDIR -type f $FINDFILTER | \
-		sed -Ee "s,($KERNELDIR)/?(.*),\1/\2 ${BACKUPKERNELDIR}/\2," | \
-		xargs -n 2 cp -pl
+	(cd $KERNELDIR && find . -type f $FINDFILTER -exec \
+	    cp -pl '{}' ${BACKUPKERNELDIR}/'{}' \;)
 
 	# Re-enable patchname expansion.
 	set +f


More information about the svn-src-all mailing list