bottlerocket-os / bottlerocket-os/twoliter

Provide a mechanism for installing additional files provided by crates

Open
#111 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
34
Forks
43
Avg merge
11h 13m
Merged PRs (30d)
16

Description

Something like this is needed to install settings extensions. Each settings extension has a configuration file associated with it, e.g. [`motd.toml`](https://github.com/cbgbt/bottlerocket/blob/639de3dfdce12c34c428702ffa073c6c97c89a24/sources/models/settings-extensions/motd/motd.toml) as part of the [`motd` settings extension](https://github.com/cbgbt/bottlerocket/tree/639de3dfdce12c34c428702ffa073c6c97c89a24/sources/models/settings-extensions/motd).

When installing this settings extension in an RPM, we need for the binary to be placed under `%{buildroot}/usr/libexec/` and the associated config file to be placed under `%{buildroot}/usr/share/settings`.

We currently use something like:

```bash
cargo build --manifest-path 'sources/Cargo.toml' -p settings-extension-name
```

to build the extension binary, but we don't have any good way to discover the config file or tell cargo to install it into the buildroot.

----

It doesn't seem like cargo can do this, but one idea could be to provide a cargo extension command or a subcommand in twoliter that can read metadata in the `Cargo.toml` manifest which tells the tool how to install additional files into a given buildroot.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the settings extension example at sources/models/settings-extensions/motd/motd.toml and the build command using sources/Cargo.toml. Compare the desired binary and configuration-file destinations under the buildroot with what Cargo and a possible twoliter subcommand can discover from Cargo.toml metadata. Done means a defined mechanism for installing the additional file alongside the extension binary.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.