The branch main has been updated by jlduran:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4f141f5ef4a531eccacf226b5a0d4507f36cfa44

commit 4f141f5ef4a531eccacf226b5a0d4507f36cfa44
Author:     Jose Luis Duran <[email protected]>
AuthorDate: 2026-01-17 18:08:03 +0000
Commit:     Jose Luis Duran <[email protected]>
CommitDate: 2026-01-17 18:08:03 +0000

    nanobsd: Switch the / partition in fstab
    
    Introduce a function tgt_switch_root_fstab() that switches the root
    partition in the target file system tab file.  Initially not wired.
    
    Reviewed by:    imp
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D48788
---
 tools/tools/nanobsd/defaults.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index fd98482f7115..13e7797df2f5 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -308,6 +308,22 @@ tgt_dir() {
        done
 }
 
+#
+# Switch the current root partition in the target file system tab.
+# Takes two arguments: the current, and the new partition.
+#
+tgt_switch_root_fstab()
+{
+       local current new
+       current="$1"
+       new="$2"
+
+       for f in ${NANO_WORLDDIR}/etc/fstab ${NANO_WORLDDIR}/conf/base/etc/fstab
+       do
+               sed -i "" "s=${NANO_DRIVE}${current}=${NANO_DRIVE}${new}=g" 
"${f}"
+       done
+}
+
 # run in the world chroot, errors fatal
 CR() {
        chroot "${NANO_WORLDDIR}" /bin/sh -exc "$*"

Reply via email to