This version is unused. At one time I accidentally bumped it
and then kept doing so occasionally. Fixate it so that doesn't
happen again.
The canonical version is in lib/Cargo.toml.
Replace all serde_json::to_{string,vec,writer} with
equivalent canon_json::CanonJsonSerialize to make the
output stable / reproducible.
Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
This adds a few basic integration tests for system-reinstall-bootc, adds
a system-reinstall option to tests-integration to run them, and executes
them as part of the github action.
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
It seems the tracing crate is broken in this respect. Digging
through best practices, `anstream` is used by clap and looks sane.
We're basically just following their example.
Signed-off-by: Colin Walters <walters@verbum.org>
This uses findmnt to locate filesystem mounts that are on the same
source as the root mount. If any are found, the user is warned these
filesystems will persist unmounted in the bootc system. The user must
hit <enter> to proceed.
This does the same for logical volumes in the same group as root.
It also adds a generic warning to help the user understand what will
happen after rebooting into the bootc system.
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Bump our composefs-rs version and adjust to the API changes there.
Also, add "BSL-1.0" (Boost Software Licence, OSI/FSF approved) to our
allowed licence lists: it's used by xxhash-rust.
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
We have a few code paths which are doing a recursive filesystem
walk and it's much easier with an API like this, especially
when one wants to keep track of the full relative path.
Signed-off-by: Colin Walters <walters@verbum.org>
No major changes required; we get to drop one `unsafe` call
which is nice!
Looks like the ecosystem overall will need a fair bit of porting
before we can drop the 0.38 version though.
Signed-off-by: Colin Walters <walters@verbum.org>
Key off the ostree prepare-root config to require fsverity
on all objects.
As part of this:
- Add a dependency on composefs-rs just for the fsverity querying
APIs, and as prep for further integration.
- Add `bootc internals fsck`, which verifies the expected
fsverity state.
Signed-off-by: Colin Walters <walters@verbum.org>
This provides stricter parsing (e.g. fails when the authorized_keys file
contains invalid content), and is groundwork for removing the command
field from keys.
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
Prior to this, the prompt to select users other that root would result
in an error. Now, all ssh keys will be gathered into a single file
and passed to bootc install to-existing-root --root-ssh-authorized-keys.
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
This is not exhaustive yet, but catches things that invoke
`useradd` (whether a dpkg/rpm `%post` or just a plain `RUN useradd` in a container)
that don't have a sysusers.d entry.
Signed-off-by: Colin Walters <walters@verbum.org>
There's probably an equivalent of this somewhere in a crate, but
basically dealing with `&Path` and printing it is annoying because
we always end up with quotes around a path, even if it's UTF-8
without any spaces.
This takes a Path and displays it in a way that will be parsable
by a shell, and takes care not to emit quotes in the simple case
where a path has no shell metacharacters, just `/`, `.` and
alphanumerics.
Signed-off-by: Colin Walters <walters@verbum.org>
I moved the code there; I plan to use open_dir_noxdev in
the tmpfiles code too which can't depend on lib/util.
Signed-off-by: Colin Walters <walters@verbum.org>
Fixes #1104
Make the podman dependency of system-reinstall-bootc optional
* Change the spec file to recommend podman instead of requiring it (this
will make it more palatable to have this package included in distros
by default)
* Now that podman is only recommended, the system-reinstall-bootc binary
must check whether podman is installed and try to install it. This is
done by launching the install-podman script that is included with the
system-reinstall-bootc RPM. The exact location where
system-reinstall-bootc will look for this script is defined in the
build environment variable `SYSTEM_REINSTALL_BOOTC_INSTALL_PODMAN_PATH`
Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
Two goals:
- The global static LINTS array is a conflict point
- It's easier to lay out the lint info when it's next to each
function; prep for extending the lint data more.
Signed-off-by: Colin Walters <walters@verbum.org>
# Background
The current usage instructions for bootc involve a long podman
invocation.
# Issue
It's hard to remember and type the long podman invocation, making the
usage of bootc difficult for users.
See https://issues.redhat.com/browse/BIFROST-610 and https://issues.redhat.com/browse/BIFROST-611
(Epic https://issues.redhat.com/browse/BIFROST-594)
# Solution
We want to make the usage of bootc easier by providing a new Fedora/RHEL
subpackage that includes a new binary `system-reinstall-bootc`. This binary
will simplify the usage of bootc by providing a simple command line
interface (configured either through CLI flags or a configuration file)
with an interactive prompt that allows users to reinstall the current
system using bootc.
The commandline will handle helping the user choose SSH keys / users,
warn the user about the destructive nature of the operation, and
eventually report issues they might run into in the various clouds (e.g.
missing cloud agent on the target image)
# Implementation
Added new system-reinstall-bootc crate that outputs the new
system-reinstall-bootc binary. This new crate depends on the existing utils crate.
Refactored the tracing initialization from the bootc binary into the
utils crate so that it can be reused by the new crate.
The new CLI can either be configured through commandline flags or
through a configuration file in a path set by the environment variable
`BOOTC_REINSTALL_CONFIG`.
The configuration file is a YAML file.
# Limitations
Only root SSH keys are supported. The multi user selection TUI is
implemented, but if you choose anything other than root you will get an
error.
# TODO
Missing docs, missing functionality. Everything is in alpha stage. User
choice / SSH keys / prompt disabling should also eventually be supported
to be configured through commandline arguments or the configuration
file.
Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
The CLI crate does not use clap directly, so it does not need to
depend on it.
It does use it indirectly, through the our lib crate
Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
Refactor the tracing initialization code into a utility function, so
that it can be shared with future CLIs that we'll add.
Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>