runit?

TheOldFellow theoldfellow at gmail.com
Sat Feb 17 00:29:29 PST 2007


Jorge Almeida wrote:
> I'm trying to understand how to use runit as substitute for sysvinit.
> The file hints/ATTACHMENTS/build-with-runit/build-with-runit-scripts.txt
> dates from 2004. Can anybody elaborate on this? (I mean, is it
> deprecated or just lacking a maintainer?) The hint says the author
> no longer supports using runit, but I really like the approach. Would
> the stage 1 and 3 files produced by the installer still be appropriate
> for a recent LFS system?
> 
> Any input would be welcome.


I wrote it. And in fact have gone back to using it recently.  The ideas
in the hint are still correct AFAIK, but there will be minor variations
with the increments of packages.

What I now do is to build LFS or CLFS according to the book, but omiting
sysvinit and syslog.  I even install the bootscripts!  Then I install
runit mostly into /sbin and /usr/sbin - I don't bother with dietlibc any
more.  My /etc/runit/1 script is just a list of calls to the LFS
bootscripts:


#!/bin/bash
# system one time tasks

PATH=/sbin:/bin:/usr/sbin:/usr/bin

/etc/rc.d/init.d/mountkernfs start
/etc/rc.d/init.d/modules start
/etc/rc.d/init.d/udev start
/etc/rc.d/init.d/swap start
/etc/rc.d/init.d/checkfs start
/etc/rc.d/init.d/mountfs start
/etc/rc.d/init.d/udev_retry start
/etc/rc.d/init.d/cleanfs start
/etc/rc.d/init.d/setclock start
/etc/rc.d/init.d/console start
/etc/rc.d/init.d/localnet start
/etc/rc.d/init.d/sysctl start
/etc/rc.d/init.d/random start

touch /etc/runit/stopit
chmod 0 /etc/runit/stopit

The /etc/runit/3 script is similar, but with 'stop', and only for those
scripts that have something in the stop branch of the case.

#!/bin/bash
exec 2>&1
PATH=/sbin:/bin:/usr/sbin:/usr/bin
LAST=0
test -x /etc/runit/reboot && LAST=6
echo 'Waiting for services to stop...'
sv -w196 force-stop /var/service/*
sv exit /var/service/*
/etc/rc.d/init.d/random stop
/etc/rc.d/init.d/mountfs stop
/etc/rc.d/init.d/swap stop
/etc/rc.d/init.d/localnet stop
echo 'Shutdown...'
sleep 2


I don't usually build gettys any more, as I build Xorg-7.x in chroot and
then just have xdm as a login.  But this is my getty-1 run and finish
scripts:

#!/bin/sh
exec /sbin/agetty 9600 tty1

#!/bin/sh
exec utmpset -w tty1

I hope this helps, if you need more just ask.

R.





More information about the lfs-support mailing list