git: 6b27e1f2eaab - main - freebsd-update: for rollback, first create directories

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Wed, 18 Oct 2023 14:54:01 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b27e1f2eaab9360a796c943da9d206515e1742b

commit 6b27e1f2eaab9360a796c943da9d206515e1742b
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-09-29 15:28:35 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-10-18 14:52:59 +0000

    freebsd-update: for rollback, first create directories
    
    rollback_files() tried to install files before creating the directories
    for those files.  In some cases this is due to special handling to
    install certain classes of files earlier than others.
    
    Just create all directories up front when performing rollback.
    
    PR:             273950
    Reviewed by:    dim
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D42020
---
 usr.sbin/freebsd-update/freebsd-update.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index 30e78f9bffa2..4866514c321e 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -3191,6 +3191,11 @@ rollback_setup_rollback () {
 
 # Install old files, delete new files, and update linker.hints
 rollback_files () {
+	# Create directories first.  They may be needed by files we will
+	# install in subsequent steps (PR273950).
+	awk -F \| '{if ($2 == "d") print }' $1/INDEX-OLD > INDEX-OLD
+	install_from_index INDEX-OLD || return 1
+
 	# Install old shared library files which don't have the same path as
 	# a new shared library file.
 	grep -vE '^/boot/' $1/INDEX-NEW |