Make primary username dynamic instead of hardcoded elgentos - #58
Merged
Conversation
The identity section is interactive, so the user may pick any username. Detect the created user (UID 1000) in the first late-command, persist it to /etc/primary-user in the target, and reference it everywhere else. Falls back to creating 'elgentos' if no user exists. Also split the first-boot script into a root and a user part: the old single-printf version over-escaped the nested su -c quoting (bash printf also interprets \") and produced a script with a syntax error, so mkcert -install never ran on first boot.
The interactive identity step already sets the chosen password; forcing elgentos123 via chpasswd overwrote it. Now chpasswd only runs when the account has no usable password (passwd -S status not P), i.e. when the user was created by the useradd fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The identity section is interactive, so the user may pick any username during installation. Previously all late-commands hardcoded
elgentos.Changes
/etc/primary-userin the target, and reference it in all later commands and the first-boot script. Falls back to creatingelgentosif no user exists.elgentos123password:chpasswdnow only runs when the account has no usable password (passwd -Sstatus notP), i.e. only for the useradd fallback. A password chosen interactively is kept.su -cquoting and generated a script with a bash syntax error, somkcert -installnever ran on first boot. Split into a root script and a user-level script so no nested escaping is needed.Validated with
autoinstall-validate.py(Valid!) and both generated first-boot scripts passbash -n.