:: [DNG] Migrating initscripts to pure…
Top Page
Delete this message
Reply to this message
Author: aitor
Date:  
To: Dng
Subject: [DNG] Migrating initscripts to pure runit
Hi,

I recently migrated sysv-rc to pure OpenRC by building a new debhelper utility dh-openrc similar to the already existent dh-runit.
You can test it in the latest genuen iso images. I'm doing the same with runit right now.

One interesting discovery has been that, for one-shot services (the opposite of long-running instances) you can use the trick of

    exec sv -v pause .


at the end of the `run` script. For example:

/ ******** BEGIN ***********/

#!/usr/bin/env /lib/runit/invoke-run
set -eu

i=0
while [ $i -lt 200 ]; do
  [ -S /run/udev/control ] && break
  sleep 0.1
  i=$((i+1))
done

[ -S /run/udev/control ] || exit 1

sleep 0.3

vdevadm trigger -s misc -a add || true
vdevadm trigger -s platform -a add || true

vdevadm settle

# Oneshot: no re-run in loop
exec sv -v pause .

/******* END *********/


Disclaimer: currently udevadm is a symlink to vdevadm in genuen, and supports several of its features (like vdevadm settle).
The existance of the `/run/udev/control` socket is necessary for the proper functioning of gparted:

https://dev1galaxy.org/viewtopic.php?id=8052&p=2 <https://dev1galaxy.org/viewtopic.php?id=8052&p=2>

It means that a long-running instance of vdev is already running. Otherwise `vdevadm trigger` wouldn't work.

Cheers,

Aitor.