Artix Linux Forum

Artix Linux => Software development => Topic started by: capezotte on 08 May 2021, 02:10:28

Title: [experiment] dash-compatible runit-rc
Post by: capezotte on 08 May 2021, 02:10:28
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.
Title: Re: [experiment] dash-compatible runit-rc
Post by: konimex on 17 May 2021, 06:50:53
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 (https://forum.artixlinux.org/index.php/topic,2582.0.html), 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.
Title: Re: [experiment] dash-compatible runit-rc
Post by: capezotte on 18 May 2021, 00:29:12
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).