Skip to content

shell: define three system credentials we can propagate into shell prompts and welcome msgs - #34297

Merged
poettering merged 2 commits into
systemd:mainfrom
poettering:shell-prompt-extra
Sep 10, 2024
Merged

shell: define three system credentials we can propagate into shell prompts and welcome msgs#34297
poettering merged 2 commits into
systemd:mainfrom
poettering:shell-prompt-extra

Conversation

@poettering

Copy link
Copy Markdown
Member

I accidentally got into contact with some stuff WSL-lookalikes do to get an identifier into a shell prompt that indicates where they are. I didn't really like it at all.

Let's do something about it: define a clean way how we can pass a shell prompt prefix or suffix into services, logins and systems: via credentials that are propagated into environment variables, which a profile.d/ drop-in then inserts into PS1 or writes to stdout.

This is useful for many things, for example, for an nspawn or vmspawn-based WSL-lookalike we could do add to the invocation: --set-credential="shell.prompt.prefix:📦 ".

Or mkosi's interactive mode could set shell.prompt.prefix credential to "💽 " or so. Could also use ANSI colors or so.

I think this is vastly more elegant then the other approaches I have seen and relatively generic and universal. It just defines three credentials and three env vars, that can be set and consumed in a sane way.

@github-actions github-actions Bot added documentation build-system units meson please-review PR is ready for (re-)review by a maintainer labels Sep 6, 2024
Comment thread profile.d/70-systemd-shell-extra.sh Fixed
@poettering
poettering force-pushed the shell-prompt-extra branch 3 times, most recently from d132053 to 355ab43 Compare September 6, 2024 16:14
YHNdnzj

This comment was marked as resolved.

@YHNdnzj

YHNdnzj commented Sep 6, 2024

Copy link
Copy Markdown
Member

Ah, hmm, if this is at PAM level it indeed should work, no matter what login unsets. Nevermind...

@poettering

Copy link
Copy Markdown
Member Author

Yeah, it definitely works great here.

Comment thread meson.build Outdated
Comment thread meson_options.txt Outdated
Comment thread profile.d/meson.build Outdated
@yuwata yuwata added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed please-review PR is ready for (re-)review by a maintainer labels Sep 6, 2024
@github-actions github-actions Bot added please-review PR is ready for (re-)review by a maintainer and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Sep 9, 2024
Comment thread profile.d/70-systemd-shell-extra.sh Fixed
Comment thread src/login/pam_systemd.c Outdated
@yuwata yuwata added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed please-review PR is ready for (re-)review by a maintainer labels Sep 9, 2024
Comment thread tmpfiles.d/meson.build Outdated
Comment thread profile.d/70-systemd-shell-extra.sh Outdated
@YHNdnzj YHNdnzj added good-to-merge/with-minor-suggestions and removed good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed labels Sep 9, 2024
@YHNdnzj YHNdnzj added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed good-to-merge/with-minor-suggestions build-system labels Sep 9, 2024
@poettering
poettering merged commit 9f6f3bd into systemd:main Sep 10, 2024
@github-actions github-actions Bot removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Sep 10, 2024
@yuwata

yuwata commented Sep 10, 2024

Copy link
Copy Markdown
Member

Maybe better to backport the second commit ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants