Page MenuHomeFreeBSD

Lua version of @shell
ClosedPublic

Authored by bapt on Oct 2 2020, 8:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 7:50 AM
Unknown Object (File)
Fri, Apr 12, 4:51 AM
Unknown Object (File)
Fri, Apr 12, 12:51 AM
Unknown Object (File)
Sun, Apr 7, 11:29 PM
Unknown Object (File)
Thu, Apr 4, 6:11 AM
Unknown Object (File)
Sun, Mar 31, 8:06 AM
Unknown Object (File)
Feb 8 2024, 12:42 PM
Unknown Object (File)
Dec 23 2023, 12:36 AM
Subscribers

Details

Summary

Bonus it manipulates less /etc/shell only adding a line if needed

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt requested review of this revision.Oct 2 2020, 8:23 AM

Use variable when possible

Use a buffer when deleting which avoid some syscalls and a temporary file

Keywords/shell.ucl
35 ↗(On Diff #77879)

Why == in the post-install and ~= here?

kevans added inline comments.
Keywords/shell.ucl
35 ↗(On Diff #77879)

This one is rewriting all the lines that arent' the shell_path, the other one is bailing out as soon as we find shell_path

Keywords/shell.ucl
35 ↗(On Diff #77879)

Mmmm, I fail to see where this answers my question.

Keywords/shell.ucl
35 ↗(On Diff #77879)

So on deinstall we bufferize the content of /etc/shells for all lines except the one we want to possibility remove.

If the shell we are interested in is found we overwrite /etc/shells if not we just drop the buffer ;)

on install this is this opposite we append our new shell only if we haven't already found it in existing /etc/shells

Keywords/shell.ucl
35 ↗(On Diff #77879)

No, I get your point about what post-install and pre-deinstall do, I did the first time around.
What about my question?

Keywords/shell.ucl
35 ↗(On Diff #77879)

Maybe I was not clear enough, doing if <not> ( sonething ) is ok, but doing if <not> (something) else (something else) is an anti-pattern, if there is an else, the test must be a positive thing and the clauses switched, otherwise it gets hard on the brain.

bapt marked 5 inline comments as done.Oct 15 2020, 6:37 AM
bapt added inline comments.
Keywords/shell.ucl
35 ↗(On Diff #77879)

Right ok, now I understand what you mean makes sense, let me fix that ;)

This revision is now accepted and ready to land.Oct 21 2020, 3:59 PM
This revision was automatically updated to reflect the committed changes.
bapt marked an inline comment as done.