Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Sep 2024 14:44:19 +0100
From:      Sad Clouds <cryintothebluesky@gmail.com>
To:        Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= <des@FreeBSD.org>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: How to upgrade custom release
Message-ID:  <20240907144419.e434d92dcced719f5da9b191@gmail.com>
In-Reply-To: <20240907093640.7609a9739e757c658357451b@gmail.com>
References:  <20240905190801.990f63880ba706a56a065a34@gmail.com> <86o7501u8o.fsf@ltc.des.dev> <20240907093640.7609a9739e757c658357451b@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
OK, I managed to create a set of scripts to perform the updates the way
I'm used to, i.e. extract base and kernel archives and then update etc
files. Simple and unobtrusive. This seems to work for standalone jails,
so will try it on real hardware soon with UFS snapshots as described in
the previous email.


# Build or download FreeBSD release archives
cd FreeBSD-14.1-arm64-aarch64 && ls -1
base.txz
kernel.txz
lib32.txz

# Root mount point at which update should happen
UPDATE_ROOT="/jails/test_update"

# Paths that need to be removed and then updated with new binaries
UPDATE_PATHS="
bin
boot
lib
libexec
rescue
sbin
usr/sbin
usr/bin
usr/include
usr/lib
usr/lib32
usr/libdata
usr/libexec
usr/share
usr/tests
"

# Remove paths with old binaries
for i in ${UPDATE_PATHS:?}
do
	chflags -R 0 ${UPDATE_ROOT:?}/${i:?}
	rm -rf ${UPDATE_ROOT:?}/${i:?}
done

# Extract new updates from base.txz
for i in ${UPDATE_PATHS:?}
do
	tar -C ${UPDATE_ROOT:?} --clear-nochange-fflags -xpf base.txz ./${i:?}
done

# Extract kernel updates (not required for jails)
tar -C ${UPDATE_ROOT:?} --clear-nochange-fflags -xpf kernel.txz

# View previous etc changes prior to update
etcupdate diff -D ${UPDATE_ROOT:?} -d ${UPDATE_ROOT:?}/var/db/etcupdate

# Update etc files
# 1) Extract etcupdate current tree from the base archive
tar -xpf base.txz ./var/db/etcupdate/current
# 2) Create etcupdate.tar.bz2 archive
tar -C ./var/db/etcupdate/current -jcf etcupdate.tar.bz2 ./ && rm -rf ./var
# 3) Run etcupdate merging new changes in etcupdate.tar.bz2 into /etc
etcupdate -D ${UPDATE_ROOT:?} -d ${UPDATE_ROOT:?}/var/db/etcupdate -F -t etcupdate.tar.bz2



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240907144419.e434d92dcced719f5da9b191>