Skip to content

Commit

Permalink
New dracut module helper to enable runit services.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan RP committed Dec 2, 2014
1 parent 6847c60 commit ca99f9f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions dracut/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ install() {
inst_hook pre-pivot 02 "$moddir/display-manager-autologin.sh"
inst_hook pre-pivot 03 "$moddir/copy-initramfs.sh"
inst_hook pre-pivot 04 "$moddir/locale.sh"
inst_hook pre-pivot 05 "$moddir/services.sh"
}
29 changes: 29 additions & 0 deletions dracut/services.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

SERVICEDIR=$NEWROOT/etc/sv/
SERVICES="$(getarg live.services)"

for f in ${SERVICES}; do
ln -s /etc/sv/$f $NEWROOT/etc/runit/runsvdir/default/
done

dhcpcd=1
for f in connmand NetworkManager wicd; do
if [ -e $SERVICEDIR/$f ]; then
unset dhcpcd
fi
done

# Enable all services by default... with some exceptions.
for f in $SERVICEDIR/*; do
_service=${f##*/}
case "${_service}" in
agetty-console|sulogin|dhcpcd-*) ;; # ignored
dhcpcd) [ -n "$dhcpcd" ] && ln -sf ${f##$NEWROOT} $NEWROOT/etc/runit/runsvdir/default/;;
*) ln -sf ${f##$NEWROOT} $NEWROOT/etc/runit/runsvdir/default/;;
esac
done

0 comments on commit ca99f9f

Please sign in to comment.