#!/bin/sh

XEN_DRBD_PATH='/usr/bin'
TOPOLOGY_NAME='network'
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 --network=${TOPOLOGY_NAME} make-links | sh -s
			if [ -z "$START_ACTION" ] || echo $START_ACTION | grep -qix nothing 
			then
				true
			else
				$XEN_DRBD_PATH/xen-drbd --network=${TOPOLOGY_NAME} $START_ACTION
			fi
		;;
		stop)
			if [ -z "$STOP_ACTION" ] || echo $STOP_ACTION | grep -qix nothing 
			then
				true
			else
				$XEN_DRBD_PATH/xen-drbd --network=${TOPOLOGY_NAME} $STOP_ACTION
			fi
		;;
		*)
			echo $0 'start|stop'
		;;
esac