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

Configuration file format #45

Open
rfairley opened this issue Apr 21, 2020 · 0 comments
Open

Configuration file format #45

rfairley opened this issue Apr 21, 2020 · 0 comments

Comments

@rfairley
Copy link
Contributor

rfairley commented Apr 21, 2020

There are several parameters which would be useful to enable configuring for each piece of information that the issuegen, motdgen, and profile scripts display.

The information which would have the configuration options:

  • SSH keys (currently in issuegen)
  • network interfaces from udev (currently in issuegen)
  • OS release (currently in motdgen)
  • failed systemd units (currently in profile)

This includes:

If there is a separate config file for each of the information above, one format could look like:

# /usr/lib/console-login-helper-messages/udev_if_snippetgen.conf

ISSUE_OUTPUT_DIR=/run/console-login-helper-messages/issue.d
ISSUE_ENABLE=true

# Example if we wanted to generate network interface information from udev to motd
# as well as issue, and we wanted to drop the snippet in the "public" run/motd.d directory.
MOTD_OUTPUT_DIR=/run/motd.d
MOTD_ENABLE=true

A script called something like udev_if_snippetgen would be invoked by a udev rule (could be a systemd service or other, for other types of information). This script would source the above config file and look for each variable named *_OUTPUT_DIR and place a copy of the snippet in each of these files. In order to separate the scripts like this, this would likely require re-architecting issuegen to be a service that has an associated .path systemd unit, which triggers issuegen upon snippets being created in /run/console-login-helper-messages/issue.d (started in #43).

Prior to rearchitecting issuegen, the current issuegen could also work with the above config file by sourcing /usr/lib/console-login-helper-messages/udev_if_snippetgen.conf and look for ISSUE_OUTPUT_DIR to output the udev interface snippets to. If this variable is unset, then the path would be set to a default path (possibly chosen after checking the util-linux version on the system). Similar can be done for motdgen.

This setup does sound quite complicated for scripts that are sourcing simple pieces of information, but long term it'd ease development to have each type of information interface with issuegen, motdgen, and the profile.sh script in a common way - that way support for new types of information (e.g. #34) could be added without modifying the issuegen, etc. scripts. (E.g. the purpose of issuegen/motdgen/profile could be to only look for snippets that land in its input snippet directory /run/console-login-helper-messages/issue.d, in #43 ). It would also mean that issuegen doesn't operate on all the information it displays, if only one is modified (e.g. right now issuegen will regenerate the SSH key snippet, if a udev rule for the network interfaces was invoked).

That'd mean when packaging this, the default types of information (SSH keys, udev interfaces, etc) could be included in an optional subpackage like console-login-helper-messages-defaults, and users could further configure it if they wanted to turn off some of the defaults. issuegen, motdgen, etc. could still be used by custom snippet generators if the users wanted to. (Currently there hasn't been mention of a need for this, but it seems useful to have).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant