summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Luis Duran <jlduran@FreeBSD.org>2026-01-17 18:08:03 +0000
committerJose Luis Duran <jlduran@FreeBSD.org>2026-01-17 18:08:03 +0000
commit4f141f5ef4a531eccacf226b5a0d4507f36cfa44 (patch)
tree711d56248fa138b65ae750ec2ec64ca6c34a3fab
parent605fb076eb33ea5c08ec6ed3bbe7b6966baa898d (diff)
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
-rwxr-xr-xtools/tools/nanobsd/defaults.sh16
1 files changed, 16 insertions, 0 deletions
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 "$*"