Page MenuHomeFreeBSD

bectl: add support for custom subcommands
AcceptedPublic

Authored by kevans on Wed, Sep 16, 3:24 AM.
Tags
None
Referenced Files
F172216216: D59718.id.diff
Wed, Sep 16, 10:33 PM
F172215201: D59718.diff
Wed, Sep 16, 10:22 PM
Unknown Object (File)
Wed, Sep 16, 11:44 AM
Unknown Object (File)
Wed, Sep 16, 11:20 AM
Unknown Object (File)
Wed, Sep 16, 9:05 AM
Unknown Object (File)
Wed, Sep 16, 4:24 AM
Unknown Object (File)
Wed, Sep 16, 4:20 AM
Subscribers

Details

Summary

This provides a slightly better way to write functionality that operates
on boot environments, in that it does some validation prior to executing
the subcommand and sets some variables up in the environment to describe
the currently-selected BE root.

My initial idea for a candidate was something like bectl ingest,
which can then be written easily like (with arg validation added):

mntp=$(bectl -r "$BE_ROOT" mount "$1")
tar -C "$mntp" -xvf -
bectl -r "$BE_ROOT" umount "$1"

This lets bectl cope with the BE root validation such that we only need
to glue a few things together and avoid making assumptions about the
pool, and we can provide a semi-consistent interface for things intended
to operate on boot environments.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 76964
Build 73847: arc lint + arc unit

Event Timeline

A shlib interface where we'll dlopen and discover commands that way could also be neat, to facilitate things that want to operate in C using libzfs/libbe. The interface would take the subcommand args, libbe handle and roll with it.

allanjude added a subscriber: allanjude.

Reviewed by: allanjude

This revision is now accepted and ready to land.Wed, Sep 16, 1:54 PM