#!/bin/sh
#
# lvm		This script handles the LVM startup/shutdown
#		so that LVMs are properly configured and available.
#

# try to load module in case that hasn't been odne yet
modprobe lvm >/dev/null 2>&1
modprobe lvm-mod >/dev/null 2>&1

[ -e /proc/lvm ] || exit 0
[ -e /etc/lvmtab ] || exit 0
[ -x /sbin/vgscan ] || exit 0

case "$1" in
	start|"")
		echo "Setting up LVM Volume Groups..."
		/sbin/vgscan
		/sbin/vgchange -a y
		;;
	
	stop)
		echo "Shutting down LVM Volume Groups... "
		/sbin/vgchange -a n
		;;

	restart|force-reload)
		$0 stop
		sleep 3
		$0 start
		;;
	
	*)
		echo "Usage: lvm {start|stop}" >&2
		exit 1
		;;
esac
