[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Status of OpenRC in Debian



On 05/24/2013 04:23 PM, Thomas Goirand wrote:
> On 05/24/2013 02:19 PM, Svante Signell wrote:
>> What is the status of packaging OpenRC for Debian? Is there a group
>> doing that, is help needed?
> 
> Ok, if you ask...
> 
> Currently, the package can build and install, at least on Linux flavors
> of Debian.
> 
> Once installed, it will unfortunately not understand the LSB headers of
> the scripts in /etc/init.d. I tried replacing the init script provided
> by the source package of sysvrc by the one shipped with OpenRC (they are
> called "runscript), and it worked very well. For fun, I replaced the LSB
> headers of essential boot init.d scripts (I tried with udev and ssh),
> and it just worked out of the box. I had "rc-status" working, together
> with the cgroups support (which is nice, right?).
> 
> Though that's not practical: we need a full drop-in replacement without
> touching the existing init.d scripts, and we don't even want to touch
> the LSB headers at all (that should be left as a decision).
> 
> But the good news is that there is already a perl script to transform
> the LSB headers into an OpenRC header. There is even 2 versions: one in
> perl, and one in Python. It is well possible that it will be
> reimplemented in C, to avoid any kind of dependencies.
> 
> One of the problem also is that OpenRC doesn't understand the concept of
> X-Start-Before: (it only has the concept of Required-Start /
> Required-Stop). So something will have to be done so that we have
> support for that.
> 
> So the work to be done will be:
> - Hook into update-rc.d, somehow either understand or convert the LSB
> headers of existing script, or convert them on-the-fly (maybe in another
> directory, like /etc/init.d/openrc or something similar).
> - Add code so that it can support X-Start-Before
> - Add a bit of configuration so that it can build on kFreeBSD
> - A tinny bit of adaptation so that the OpenRC ebegin / eend calls are
> replaced by the usual lsb-base calls (I didn't look at it much, but that
> shouldn't be hard, really), so that we get the nicer usual Debian boot
> script prints.
> 
> I just tried to build it in kFreeBSD (on a virtualbox VM), and
> unfortunately, it suffers from the usual problems in this arch: it needs
> a bit of adaptation, because it doesn't detect the arch correctly. It
> should really be only configuring and not programming (eg, write the
> mk/kFreeBSD.mk files, etc.), and not code, since there are already some
> build for OpenRC working in many *BSD unix (FreeBSD, NetBSD...).
> 
> I'm not really sure if there's more work to be done, but I think that
> should be it. Probably heroxbd or Roger (hereby CC:) can tell their
> opinion on what's left to implement. If that is it, then that's not so
> much, IMO, and that's not so hard either (the hardest part, IMO, is the
> X-Start-Before support, which is the only part which requires a bit of
> thinking and algorithm, though since we already have implementation in
> sysvrc, it should be fairly easy to have a look how it is done...).
> 
> We currently have a Google Summer of Code project to cover the above,
> for which I am a mentor. Roger Leigh & heroxbd (who is a Gentoo
> developer, and upstream for OpenRC) are co-mentors. I have good hopes
> that by September we will have all of the above implemented (this
> depends how good the GSoC student will be, and it is my understanding
> that I can't, for the moment, disclose (yet) who we have chosen among
> the 6 candidates).
> 
> For those who want to see an example of what a runscript looks like,
> here's 2 examples, taken from the source of OpenRC on our Alioth Git (in
> collab maint):
> 
> ~/sources/debian_packaging/openrc/openrc# more init.d/swap-blk.in
> #!@PREFIX@/sbin/runscript
> # Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
> # Released under the 2-clause BSD license.
> 
> depend()
> {
> 	before fsck
> 	keyword -jail -prefix
> }
> 
> start()
> {
> 	ebegin "Activating block swap devices"
> 	swapctl -A -t blk >/dev/null
> 	eend 0 # If swapon has nothing todo it errors, so always return 0
> }
> 
> stop()
> {
> 	ebegin "Deactivating block swap devices"
> 	swapctl -U -t blk >/dev/null
> 	eend 0
> }
> ~/sources/debian_packaging/openrc/openrc# more init.d/rarpd.in
> #!@PREFIX@/sbin/runscript
> # Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
> # Released under the 2-clause BSD license.
> 
> command=/usr/sbin/rarpd
> command_args="-f $rarpd_args"
> pidfile=/var/run/rarpd.pid
> name="Reverse ARP Daemon"
> required_files=/etc/ethers
> 
> if [ -z "$rarpd_interface" ]; then
> 	command_args="$command_args -a"
> else
> 	command_args="$command_args $rarpd_interface"
> fi
> command_background=YES
> 
> depend()
> {
> 	need localmount
> 	after bootmisc
> 	need net
> }
> 
> These are 2 random examples taken from the source, they might not be the
> best. Feel free to have a look yourself (in the init.d folder of the
> sources on the Git on Alioth: see below). There are also some much more
> complex runscripts available, and some which are even smaller than the
> above (not one liners, but nearly...).
> 
> I believe that the #!/sbin/runscript isn't even needed anymore, and that
> using #!/sbin/sh also works (heroxbd, can you confirm that fact?).
> 
> As you can see from the above, there are multiple ways to implement a
> runscript. Either you just use the current init.d sysvrc scripts, which
> are supported. Either you re-implement the start() and stop() function.
> Either you simply tell OpenRC what your command and daemon is, and
> OpenRC does the rest. This is in fact, what I like about it. It leaves
> the maintainer free to do what he feels right, and doesn't tight you in
> a closed declarative only environment, even though that is what you
> should stick to if possible (of course, why make things simple if you
> can make it complicated? :) ).
> 
> Now, about help: *OF COURSE WE ACCEPT HELP*!!! Feel free to spend your
> nights on it. I currently have no time to do the work myself (I have
> really enough work to do on OpenStack). If you decide to help, I'm sure
> you will find it a lot of fun. This project is really cool and simple,
> and hacking on it is a real pleasure. When I spent an afternoon with
> Patrick working on a proof of concept, it was just great!
> 
> If you wish to download the package source, it's there:
> git://anonscm.debian.org/collab-maint/openrc.git
> 
> it currently has the lsb.pl script as a patch over here:
> debian/patches/lsb-header-support.patch
> 
> though it doesn't have the python implementation of Bill Wang.
> 
> Roger, Patrick, Bill, heroxbd, your comments on the above are more than
> welcome. I hope I didn't write too much false statements... :)
> 
> Cheers,
> 
> Thomas Goirand (zigo)

I can disclose it now. Bill Wang (hereby CC:) will be our GSoC student.

Thomas


Reply to: