Skip to main content
Topic: [experiment] dash-compatible runit-rc (Read 768 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[experiment] dash-compatible runit-rc

I've been experimenting with a dash-compatible version of runit-rc:

https://github.com/oc1024/runit-rc-sh

Caveats:
- I'm only really testing this with dash as /bin/sh (though I have run some reboots with mksh and bash, and they seemed to work just as well).
- I might have misunderstood what Artix developers wanted to do with some scripts and introduced bugs (latest commit was fixing one such bug).
- Haven't tested features I don't use (cryptsetup and LVM)
- No real packaging yet.

But hey, I've gotten to the Works On My Machine™️ stage, which is better than nothing.

Re: [experiment] dash-compatible runit-rc

Reply #1
I've been planning to rewrite runit-rc in plain POSIX shell for some time but haven't have the time.
I've also replaced the old bash cryptsetup script with a cleaner one, it should be POSIX-compatible but I put bash shebang for compatibility with old function script. Feel free to test that one.

In any case, thanks! I'll be sure to look at your repo for one of the pointers should I finally get around it.
now only the dinit guy in artix

Re: [experiment] dash-compatible runit-rc

Reply #2
One thing I've been curious about when writing the code in that repository (and is present in the rewritten version of cryptsetup):

Code: [Select]
command_that_can_fail
rc=$?
(( rc || $? )) && stat_fail

I've seen this pattern in a lot of scripts in sv.d. Is there an edge case in command_that_can_fail || stat_fail that this works around?

By the way, ((MATH)) is bash/ksh specific, you might want to include a polyfill for in functions (as I did in my experimental repo, math_check).