#!/bin/sh

XEN_DRBD_PATH='/usr/bin'
TOPOLOGY_NAME='xen-drbd'
START_ACTION='nothing'
STOP_ACTION='nothing'
[ -e /etc/default/xen-drbd ] && . /etc/default/xen-drbd

case $1 in
		start)
			$XEN_DRBD_PATH/xen-drbd-install.py ${TOPOLOGY_NAME} make-links | sh -s
			if [ -z "$START_ACTION" ] || echo $START_ACTION | grep -qix nothing 
			then
				true
			else
				$XEN_DRBD_PATH/xen-drbd.py $START_ACTION
			fi
		;;
		stop)
			if [ -z "$STOP_ACTION" ] || echo $STOP_ACTION | grep -qix nothing 
			then
				true
			else
				$XEN_DRBD_PATH/xen-drbd.py $STOP_ACTION
			fi
		;;
		*)
			echo $0 'start|stop'
		;;
esac