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

Use usermod instead of lchsh in custom.just #585

Merged
merged 2 commits into from
Oct 13, 2023
Merged

Use usermod instead of lchsh in custom.just #585

merged 2 commits into from
Oct 13, 2023

Conversation

b-
Copy link
Contributor

@b- b- commented Oct 13, 2023

This fixes #408 (just fish and just zsh failing). The problem (and the reason that #420 doesn't fix it) is because the lchsh command actually doesn't accept the new shell as a CLI argument at all!

Another way to do this (and continue using lchsh) would be to instead run the commands as, e.g., echo /usr/bin/zsh | sudo lchsh $USER, but this results in an empty (and thus slightly misleading) prompt being shown to the user:

$ echo /usr/bin/zsh | sudo lchsh $USER
[sudo] password for bri: 
Changing shell for bri.
New Shell [/usr/bin/zsh]: Shell changed.

If we just use usermod it doesn't actually give any feedback, so I also threw in a little posix pipe to parse the shell back out of /etc/passwd after.

This fixes #408 (`just fish` and `just zsh` failing). The problem (and the reason that #420 doesn't fix it) is because the `lchsh` command actually doesn't accept the new shell as a CLI argument at all!

Another way to do this (and continue using `lchsh`) would be to instead run the commands as, e.g., `echo /usr/bin/zsh | sudo lchsh $USER`, but this results in an empty (and thus slightly misleading) prompt being shown to the user:

```console
$ echo /usr/bin/zsh | sudo lchsh $USER
[sudo] password for bri: 
Changing shell for bri.
New Shell [/usr/bin/zsh]: Shell changed.```

If we just use `usermod` it doesn't actually give any feedback, so I also threw in a little posix pipe to parse the shell back out of /etc/passwd after.
@b- b- requested a review from castrojo as a code owner October 13, 2023 01:52
This fixes #408 (`just fish` and `just zsh` failing). The problem (and the reason that #420 doesn't fix it) is because the `lchsh` command actually doesn't accept the new shell as a CLI argument at all!

Another way to do this (and continue using `lchsh`) would be to instead run the commands as, e.g., `echo /usr/bin/zsh | sudo lchsh $USER`, but this results in an empty (and thus slightly misleading) prompt being shown to the user:

```console
$ echo /usr/bin/zsh | sudo lchsh $USER
[sudo] password for bri:
Changing shell for bri.
New Shell [/usr/bin/zsh]: Shell changed.
```

If we just use `usermod` it doesn't actually give any feedback, so I also threw in a little posix pipe to parse the shell back out of /etc/passwd after.
Copy link
Member

@castrojo castrojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, thank you! I'm sure @bketelsen will be happy!

@castrojo castrojo added this pull request to the merge queue Oct 13, 2023
Merged via the queue into ublue-os:main with commit 9a8909c Oct 13, 2023
@b- b- deleted the patch-1 branch October 13, 2023 14:36
awesomekyle pushed a commit to awesomekyle/bluefin that referenced this pull request Apr 24, 2024
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.

just fish and just zsh failing
2 participants