#! /bin/sh
#
# evms          Enterprise Volume Management System
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#               Modified for evms package
#               by Matt Zimmerman <mdz@debian.org>
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=evms
DESC="Enterprise Volume Management System"

test -x /sbin/evms_rediscover || exit 0

set -e

# Only run if EVMS modules have been loaded.  If no modules are
# loaded, evms modules have been compiled in, in which case discovery
# has already been done by the kernel, or there is no evms support,
# and thus nothing for us to do.

if ! lsmod | egrep -q '^(ldev_mgr|dos_part|lvm_vge|evms.*|md_core|md_linear|md_raid0|md_raid1|AIXlvm_vge|os2lvm_vge|snapshot) '; then
  exit 0
fi

case "$1" in
  start|reload|restart|force-reload)
	echo -n "Starting $DESC: "
        evms_rediscover
        evms_devnode_fixup
	echo "$NAME."
	;;
  stop)
        # Nothing to do
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0
