Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

controller: Add relative vendor prefix by default #71

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ermo
Copy link
Member

@ermo ermo commented Mar 9, 2023

This should allow e.g. /usr/local/bin/boulder to look for its configuration files in /usr/local/bin/../share/

Depends on serpent-os/libmoss#2

@ermo
Copy link
Member Author

ermo commented Mar 12, 2023

Looks like this needs a bit of design work:

  • Use the relative tooling binDir of the executed binary for executing sister binaries:
    • onboarding/dev case:
      /usr/local/bin/boulder => binDir = /usr/local/bin/{moss, moss-container}
    • package manager/production case:
      /usr/bin/boulder => binDir = /usr/bin/{moss, moss-container}
  • If a config prefix root is specified with -C foo, use configPrefix = foo and assume default vendorPrefix = /usr for config files
  • If a config prefix is not specified, use configPrefix = / and set vendorPrefix = binDir/..

NB: In normal use, full paths aren't specified, so the first hit in $PATH will be used. Hence, it will likely be useful if binaries explicitly specify their binDir in a trace statement (to verify assumptions).

Examples:

## pkg manager boulder, automagically deduced relative vendorPrefix
sudo /usr/bin/boulder build stone.yml
# binDir= /usr/bin
# configPrefix = /
# vendorPrefix = /usr/bin/..
# configuration file searchPath = [/usr/bin/../share/boulder, /etc/boulder]

## onboarding boulder, automagically deduced relative vendorPrefix
sudo /usr/local/bin/boulder build stone.yml
# binDir = /usr/local/bin
# configPrefix = /
# vendorPrefix = /usr/local/bin/..
# configuration file searchPath = [/usr/local/bin/../share/boulder, /etc/boulder]

## onboarding boulder, pkg manager configPrefix (bugfix test case)
sudo /usr/local/bin/boulder -C / build stone.yml
# binDir = /usr/local/bin
# configPrefix = /
# vendorPrefix = /usr
# configuration file searchPath = [/usr/share/boulder, /etc/boulder]

## pkg manager boulder, custom configPrefix
sudo /usr/bin/boulder -C /var/lib/machines/sosroot build stone.yml
# binDir = /usr/bin
# configPrefix = /var/lib/machines/sosroot
# vendorPrefix = /var/lib/machines/sosroot/usr
# configuration file searchPath = [/var/lib/machines/sosroot/usr/share/boulder, /var/lib/machines/sosroot/etc/boulder]

@ikeycode: Does ^ sound about right to you?

This should allow e.g. /usr/local/bin/boulder to look for its
configuration files in /usr/local/bin/../share/

Signed-off-by: Rune Morling <[email protected]>
ermo and others added 4 commits March 13, 2023 18:25
Introduces configRootPrefix (was configPrefix) and vendorPrefix.

configRootPrefix defaults to "/" and vendorPrefix defaults to a
relativePrefix based on where this boulder instance is run from:

    /usr/local/bin/boulder -> vendorPrefix = /usr/local/bin/../
    /usr/bin/boulder -> vendorPrefix = /usr/bin/../

If a configRootPrefix is specified on the command line, vendorPrefix is
hardcoded to vendorPrefix = /usr to ensure that configurations inside
moss-controlled roots are respected.

configRootPrefix and vendorPrefix are passed along to moss-config, which
then generates config file vendor search paths and admin override search
paths.

Signed-off-by: Rune Morling <[email protected]>
Fixes boulder exiting with code 1 after a successful build if a recipe
location wasn't passed to args and boulder just built the stone.yml
recipe found in the current location.
Why?
- Manifest files get overridden
- Needs additional logic for the exit code, i.e. build A fails and
  build B succeeds, what to return? exit early?
- Umounting logic doesn't work correctly.
@ermo ermo marked this pull request as draft January 30, 2024 21:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants