leahneukirchen / ignite

OBSOLETE: use Void Linux
Other
66 stars 12 forks source link

Allow service@blah? #29

Closed mikejsavage closed 11 years ago

mikejsavage commented 11 years ago

Starting multiple instances of a daemon with different configs by running eg systemctl enable netcfg@wifi-uni is one of the nice things about systemd.

This is tricky to get working in ignite because of the requirement that it works on read only roots.

Possible implementation:

/etc/runit/2:

...

     case ${daemon:0:1} in
       !) ;;
       *)
         [[ $daemon =~ ([^@]+@)([^@]+) ]]
         if [ ${BASH_REMATCH[1]} ]; then
           cp -r /etc/sv/${BASH_REMATCH[1]} $d/$daemon
           ln -s /run/runit/supervise.$daemon $d/$daemon/supervise
           echo -n "${BASH_REMATCH[2]}" > $d/$daemon/config
         else
           ln -s /etc/sv/$daemon $d
         fi;;
     esac

...

Example daemon: /etc/sv/tincd@/run:

#! /bin/sh
PROFILE=`cat config`
exec /usr/bin/tincd -D -n $PROFILE

This is inconsistent with the rest of ignite - no supervise in /etc/sv/..., creating actual files in /run instead of symlinks

leahneukirchen commented 11 years ago

run scripts can parse their cwd if this is needed.