Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] [openrc] [systemd] make `service` common for both OpenRC and SystemD (like Debian/Ubuntu/whatever did)
Date: Sat, 16 Sep 2017 20:09:49
Message-Id: CAGfcS_nbyh=rwh4ZKeMWG0N=BXq8rBUuGQL3PCQyaUx-YA1TGQ@mail.gmail.com
In Reply to: [gentoo-dev] [openrc] [systemd] make `service` common for both OpenRC and SystemD (like Debian/Ubuntu/whatever did) by "Vadim A. Misbakh-Soloviov"
1 On Sat, Sep 16, 2017 at 3:56 PM, Vadim A. Misbakh-Soloviov
2 <gentoo@×××.name> wrote:
3 >
4 > I'd like to suggest to remove `service` widget from openrc and make it the
5 > part of (which package? baselayout?)?
6
7 IMO this really should go in its own package. By all means have
8 openrc and/or systemd pull it in by default, but this gives everybody
9 a bit more control. This was the approach with functions.sh as well.
10
11 >
12 > P.S. actually, it also would be nice to add "generators" thing to it too, to
13 > make it possible to manage services that have no systemd's units under SystemD
14 > and services that have only units under OpenRC (well, that one looks much
15 > harder than first variant, but, again, looks like deb/ubuntu guys did that
16 > work already and we can try to use their work as cheatsheet)
17 >
18
19 We don't really have the same situation that they do. IMO this is
20 best done by having some kind of wrapper that needs to be manually
21 invoked. I think most people would want to know the first time they
22 go to start a service that wasn't really tested under their particular
23 configuration. The service might not work the way they expect, so
24 they'd want to pay closer attention to it, for a start.
25
26 Wrapping systemd units into openrc scripts should be relatively easy,
27 because they're descriptive. You just need a parser of some kind.
28 The only issue I see is any code that has to run in global context -
29 I'm not sure how well openrc behaves when dependency parsing starts
30 running code.
31
32 Going in the other direction will be harder, but probably is possible.
33
34 Honestly, though, it isn't like it is that hard to write a unit or
35 script, so I think most people are going to prefer to hand-write them.
36 One of the really nice things about Gentoo is that whether you use
37 openrc or systemd you get a completely native experience without a ton
38 of duct-tape adapting one system into a completely different one, full
39 of caveats and stuff that doesn't behave like you'd expect. IMO the
40 only other distro that delivers a similar experience with systemd is
41 Arch, and they don't support openrc really.
42
43 But, nobody is going to complain if you create a tool that creates
44 init.d scripts or units automatically for you. People can use it as
45 they wish, and it might or might not make a good starting point for a
46 new script/unit.
47
48 --
49 Rich