From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 16 Oct 2009 05:54:12 +0000 From: Andy Spencer To: "9fans@9fans.net" <9fans@9fans.net> Message-ID: <20091016055412.GA30563@c.hsd1.tn.comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Subject: [9fans] Booting with mk Topicbox-Message-UUID: 8826d002-ead5-11e9-9d60-3106f5b1d025 My friend Mike and I were talking a while back about Unix init systems and came to the conclusion that mk's dependency tracking could come in handy. I decided to implement it a few days ago using plan9port and thought that some of the folks here might be interested. Although, I still haven't decided if it's really neat, or completely evil :-) The code is available here, along with a fuller README: https://lug.rose-hulman.edu/svn/misc/trunk/mkinit/ It consists of a bash script (the rc version has issues..) that runs as the actually init daemon, a mkfile that contains a list of rules for starting and stopping services, and a some helper programs. It's based on mk so any mk rules could be used. What I use is a few rules to denote runlevels and then a bunch of rules for starting and stopping services of the form: foo-start:VPservice -u: deps-start .. foo-stop:VPservice -d: rdeps-stop .. service -[ud] is just a helper script that determines if the services is already up or down in order to avoid re-starting/stopping it. Dependency tracking is pretty strait forward, but foo-stop dependencies are backwards because the dependencies for the rule denote the services that must be stopped before foo can be stopped. What this ends up creating is two separate DAGs, one for booting and one for halting. I've been using it the past couple days and it seems to work pretty nicely, but it's still largely untested, and there are a few bugs such utmp being broken.. It's also a good bit faster than sysvinit due to mk's parallelization, bootcharts below. http://andy753421.ath.cx/temp/mkinit.png http://andy753421.ath.cx/temp/sysvinit.png