Page MenuHomeFreeBSD

nanobsd.sh: Start the transition away from 'legacy' config
AcceptedPublic

Authored by imp on Dec 12 2025, 7:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 1, 3:35 PM
Unknown Object (File)
Wed, Jan 28, 1:22 AM
Unknown Object (File)
Tue, Jan 27, 4:44 PM
Unknown Object (File)
Tue, Jan 27, 1:02 PM
Unknown Object (File)
Fri, Jan 16, 8:28 AM
Unknown Object (File)
Sat, Jan 10, 8:44 AM
Unknown Object (File)
Sat, Jan 10, 5:40 AM
Unknown Object (File)
Thu, Jan 8, 9:37 AM
Subscribers
None

Details

Reviewers
jlduran
Summary

I designated the old way to do things as 'legacy' a long time ago. But
then the work stalled. To facilitate co-existance, old legacy files will
need to have 'legacy' at the top. This will preserve all the old
behavior as new ways to build are rolled out. The legacy plan is the
default for now, but one day we'll have no default and failure to select
a plan will be an error.

As a transition hack, if no plan is defined, include legacy.sh like we
used to do. Since this is after the config stage, we only define the
imaging functions in legacy.sh:
calculate_partitioning
create_code_slice
create_diskimage
if they aren't already defined.

For the embedded configs, set NANO_PLAN=embedded so we don't include
legacy.sh.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69194
Build 66077: arc lint + arc unit

Event Timeline

imp requested review of this revision.Dec 12 2025, 7:33 AM
imp created this revision.

"... as new ways to build are rolled out" nice!

tools/tools/nanobsd/nanobsd.sh
38

Just this minor nit:
function needs another * afterwards, because the output of type wil continue printing the function/subroutine.

Although, I would prefer something more explicit (maybe just a noob thing):

is_defined() {
	case $(type "$1" 2>/dev/null | sed -n "1p") in
	*"is a function"*) return 0 ;;
	*) return 1 ;;
	esac
}
tools/tools/nanobsd/nanobsd.sh
38

Sorry:
... something more explicit (maybe just a noob thing):

is_defined() {
	case $(type "$1" 2>/dev/null | sed -n "1p") in
	"$1 is a function") return 0 ;;
	*) return 1 ;;
	esac
}
tools/tools/nanobsd/nanobsd.sh
38

"$1 is a shell function"

Apologies, I was testing on macOS.

This revision is now accepted and ready to land.Dec 12 2025, 4:11 PM