services.sh 901 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
  3. # ex: ts=8 sw=4 sts=4 et filetype=sh
  4. type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
  5. SERVICEDIR=$NEWROOT/etc/sv
  6. SERVICES="$(getarg live.services)"
  7. for f in ${SERVICES}; do
  8. ln -sf /etc/sv/$f $NEWROOT/etc/runit/runsvdir/default/
  9. done
  10. dhcpcd=1
  11. for f in connmand NetworkManager wicd; do
  12. if [ -e $SERVICEDIR/$f ]; then
  13. unset dhcpcd
  14. fi
  15. done
  16. # Enable all services by default... with some exceptions.
  17. for f in $SERVICEDIR/*; do
  18. _service=${f##*/}
  19. case "${_service}" in
  20. agetty-console|agetty-generic|agetty-serial|agetty-tty[SAU]*|sulogin|dhcpcd-*|iptables|ip6tables|wpa_supplicant) ;; # ignored
  21. dhcpcd) [ -n "$dhcpcd" ] && ln -sf ${f##$NEWROOT} $NEWROOT/etc/runit/runsvdir/default/;;
  22. *) ln -sf ${f##$NEWROOT} $NEWROOT/etc/runit/runsvdir/default/;;
  23. esac
  24. done