Skip to content

Comments

Add pts number login substitution#124

Closed
michael-oberpriller wants to merge 3 commits intoAetf:mainfrom
michael-oberpriller:Login-Substitution
Closed

Add pts number login substitution#124
michael-oberpriller wants to merge 3 commits intoAetf:mainfrom
michael-oberpriller:Login-Substitution

Conversation

@michael-oberpriller
Copy link

Thanks to @kreijack for the idea and code. This adds the ability to use the string "{ptsname}" in the login command to get the name of the pts device used by kmscon. This is useful for printing out the pts name with agetty as described in #24. This is also needed for my plan of implementing running services in #122, since the pts name will need to be given to the service to properly run on the pty. If this approach isn't desired, we could also store the pts name to an environment variable similar to $XDG_VTNR.

@michael-oberpriller
Copy link
Author

michael-oberpriller commented Jul 26, 2025

After furrher testing, I found that this can be done by instead using the following commands in the login string.
$(tty | sed 's|^/dev/||')

@michael-oberpriller
Copy link
Author

I reopened this since using this removes the requirement of using sh -c "command" for the login option with the $(tty | sed 's|^/dev/||') workaround. Now {pts_number} is replaced by just the number not pts/number. Also, now strings containing {pts_number} are altered, instead of just strings that are {pts_number}.

@michael-oberpriller michael-oberpriller changed the title Add pts name login substitution Add pts number login substitution Aug 2, 2025
@michael-oberpriller michael-oberpriller marked this pull request as draft August 5, 2025 06:04
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

Successfully merging this pull request may close these issues.

1 participant