Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/docs: Expand and clean up clap doctext a bit #609

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/src/man/bootc-container-lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ checks as part of a container build
# DESCRIPTION

Perform relatively inexpensive static analysis checks as part of a
container build
container build.

This is intended to be invoked via e.g. \`RUN bootc container lint\` as
part of a build process; it will error if any problems are detected.

# OPTIONS

**-h**, **\--help**

: Print help
: Print help (see a summary with -h)

# VERSION

Expand Down
14 changes: 12 additions & 2 deletions docs/src/man/bootc-install-to-disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ bootc-install-to-disk - Install to the target block device

# DESCRIPTION

Install to the target block device
Install to the target block device.

This command must be invoked inside of the container, which will be
installed. The container must be run in \`\--privileged\` mode, and
hence will be able to see all block devices on the system.

The default storage layout uses the root filesystem type configured in
the container image, alongside any required system partitions such as
the EFI system partition. Use \`install to-filesystem\` for anything
more complex such as RAID, LVM, LUKS etc.

# OPTIONS

Expand Down Expand Up @@ -58,7 +67,8 @@ previous paragraph. See skopeo(1) for accepted formats.

**\--target-transport**=*TARGET_TRANSPORT* \[default: registry\]

: The transport; e.g. oci, oci-archive, containers-storage. Defaults to \`registry\`
: The transport; e.g. oci, oci-archive, containers-storage. Defaults
to \`registry\`

**\--target-imgref**=*TARGET_IMGREF*

Expand Down
14 changes: 10 additions & 4 deletions docs/src/man/bootc-install-to-existing-root.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# NAME

bootc-install-to-existing-root - Perform an installation to the host
root filesystem
bootc-install-to-existing-root - Install to the host root filesystem

# SYNOPSIS

Expand All @@ -16,7 +15,13 @@ root filesystem

# DESCRIPTION

Perform an installation to the host root filesystem
Install to the host root filesystem.

This is a variant of \`install to-filesystem\` that is designed to
install \"alongside\" the running host root filesystem. Currently, the
host root filesystems \`/boot\` partition will be wiped, but the content
of the existing root will otherwise be retained, and will need to be
cleaned up if desired when rebooted into the new root.

# OPTIONS

Expand Down Expand Up @@ -48,7 +53,8 @@ previous paragraph. See skopeo(1) for accepted formats.

**\--target-transport**=*TARGET_TRANSPORT* \[default: registry\]

: The transport; e.g. oci, oci-archive, containers-storage. Defaults to \`registry\`
: The transport; e.g. oci, oci-archive, containers-storage. Defaults
to \`registry\`

**\--target-imgref**=*TARGET_IMGREF*

Expand Down
13 changes: 10 additions & 3 deletions docs/src/man/bootc-install-to-filesystem.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# NAME

bootc-install-to-filesystem - Install to the target filesystem
bootc-install-to-filesystem - Install to an externally created
filesystem structure

# SYNOPSIS

Expand All @@ -16,7 +17,12 @@ bootc-install-to-filesystem - Install to the target filesystem

# DESCRIPTION

Install to the target filesystem
Install to an externally created filesystem structure.

In this variant of installation, the root filesystem alongside any
necessary platform partitions (such as the EFI system partition) are
prepared and mounted by an external tool or script. The root filesystem
is currently expected to be empty by default.

# OPTIONS

Expand Down Expand Up @@ -75,7 +81,8 @@ previous paragraph. See skopeo(1) for accepted formats.

**\--target-transport**=*TARGET_TRANSPORT* \[default: registry\]

: The transport; e.g. oci, oci-archive, containers-storage. Defaults to \`registry\`
: The transport; e.g. oci, oci-archive, containers-storage. Defaults
to \`registry\`

**\--target-imgref**=*TARGET_IMGREF*

Expand Down
4 changes: 2 additions & 2 deletions docs/src/man/bootc-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ bootc-install-to-disk(8)

bootc-install-to-filesystem(8)

: Install to the target filesystem
: Install to an externally created filesystem structure

bootc-install-to-existing-root(8)

: Perform an installation to the host root filesystem
: Install to the host root filesystem

bootc-install-print-configuration(8)

Expand Down
3 changes: 2 additions & 1 deletion docs/src/man/bootc-switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ updates via container image tags; for example,

**\--transport**=*TRANSPORT* \[default: registry\]

: The transport; e.g. oci, oci-archive, containers-storage. Defaults to \`registry\`
: The transport; e.g. oci, oci-archive, containers-storage. Defaults
to \`registry\`

**\--enforce-container-sigpolicy**

Expand Down
30 changes: 26 additions & 4 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,37 @@ pub(crate) struct StatusOpts {
pub(crate) booted: bool,
}

/// Options for internal testing
#[cfg(feature = "install")]
#[derive(Debug, clap::Subcommand, PartialEq, Eq)]
pub(crate) enum InstallOpts {
/// Install to the target block device
/// Install to the target block device.
///
/// This command must be invoked inside of the container, which will be
/// installed. The container must be run in `--privileged` mode, and hence
/// will be able to see all block devices on the system.
///
/// The default storage layout uses the root filesystem type configured
/// in the container image, alongside any required system partitions such as
/// the EFI system partition. Use `install to-filesystem` for anything more
/// complex such as RAID, LVM, LUKS etc.
ToDisk(crate::install::InstallToDiskOpts),
/// Install to the target filesystem
/// Install to an externally created filesystem structure.
///
/// In this variant of installation, the root filesystem alongside any necessary
/// platform partitions (such as the EFI system partition) are prepared and mounted by an
/// external tool or script. The root filesystem is currently expected to be empty
/// by default.
ToFilesystem(crate::install::InstallToFilesystemOpts),
/// Install to the host root filesystem.
///
/// This is a variant of `install to-filesystem` that is designed to install "alongside"
/// the running host root filesystem. Currently, the host root filesystem's `/boot` partition
/// will be wiped, but the content of the existing root will otherwise be retained, and will
/// need to be cleaned up if desired when rebooted into the new root.
ToExistingRoot(crate::install::InstallToExistingRootOpts),
/// Output JSON to stdout that contains the merged installation configuration
/// as it may be relevant to calling processes using `install to-filesystem`
/// that want to honor e.g. `root-fs-type`.
/// that in particular want to discover the desired root filesystem type from the container image.
///
/// At the current time, the only output key is `root-fs-type` which is a string-valued
/// filesystem name suitable for passing to `mkfs.$type`.
Expand All @@ -149,6 +168,9 @@ pub(crate) struct ManOpts {
pub(crate) enum ContainerOpts {
/// Perform relatively inexpensive static analysis checks as part of a container
/// build.
///
/// This is intended to be invoked via e.g. `RUN bootc container lint` as part
/// of a build process; it will error if any problems are detected.
Lint,
}

Expand Down
3 changes: 0 additions & 3 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ pub(crate) struct InstallConfigOpts {
pub(crate) generic_image: bool,
}

/// Perform an installation to a block device.
#[derive(Debug, Clone, clap::Parser, Serialize, Deserialize, PartialEq, Eq)]
pub(crate) struct InstallToDiskOpts {
#[clap(flatten)]
Expand Down Expand Up @@ -244,7 +243,6 @@ pub(crate) struct InstallTargetFilesystemOpts {
pub(crate) skip_finalize: bool,
}

/// Perform an installation to a mounted filesystem.
#[derive(Debug, Clone, clap::Parser, PartialEq, Eq)]
pub(crate) struct InstallToFilesystemOpts {
#[clap(flatten)]
Expand All @@ -260,7 +258,6 @@ pub(crate) struct InstallToFilesystemOpts {
pub(crate) config_opts: InstallConfigOpts,
}

/// Perform an installation to the host root filesystem.
#[derive(Debug, Clone, clap::Parser, PartialEq, Eq)]
pub(crate) struct InstallToExistingRootOpts {
/// Configure how existing data is treated.
Expand Down
Loading