In backup_kernel(), support backing up subdirectories and handle files
with spaces correctly. Approved by: cperciva MFC after: 1 month
This commit is contained in:
parent
a458eaa039
commit
ab7d0151f9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212505
@ -2638,11 +2638,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
|
||||
@ -2663,9 +2665,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
|
||||
|
Loading…
Reference in New Issue
Block a user