mdraid.initd 762 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/openrc-run
  2. # Copyright 1999-2015 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. depend() {
  5. before checkfs fsck
  6. after modules
  7. }
  8. start() {
  9. local output
  10. ebegin "Starting up RAID devices"
  11. output=$(mdadm -As ${MDADM_ASSEMBLE_OPTS} 2>&1)
  12. eend $? "${output}"
  13. local pat="/dev/md_d*"
  14. set -- ${pat}
  15. if [ "$*" != "${pat}" ] ; then
  16. ebegin "Creating RAID device partitions"
  17. blockdev "$@"
  18. eend $?
  19. # wait because vgscan runs next, and we want udev to fire
  20. sleep 1
  21. fi
  22. return 0
  23. }
  24. stop() {
  25. local output
  26. # XXX: Maybe drop this check ?
  27. [ ! -e /etc/mdadm/mdadm.conf ] && [ ! -e /etc/mdadm.conf ] && return 0
  28. ebegin "Shutting down RAID devices (mdadm)"
  29. output=$(mdadm -Ss 2>&1)
  30. eend $? "${output}"
  31. }