#!/bin/sh
#============================================================================
# $NetBSD$
#
# @PKG_SYSCONFDIR@/network
#
# Script for starting and stopping the network configuration for the Xen
# domains.  The xend(8) daemon calls a network script when it starts,
# before any guest domains are started.  The xend(8) daemon also calls
# a network script when it stops.  The script name to use is defined in
# @PKG_SYSCONFDIR@/xend-config.sxp in the ``network-script'' field.
# 
# Usage: network start|stop|status [var=value ...]
#
# Actions:
#    start	Create the network configuration for the Xen domains.
#    stop	Destroy the network configuration for the Xen domains.
#    status	Print some network-related information, e.g. ifconfig
#		and routes.
#
# This script may be customized so that the "start" action creates the
# bridge device(s) to which the guest domains' vifs should connect.
# However, it is simpler to create any network devices at system startup
# via /etc/ifconfig.* scripts, e.g. if dom0 has a bge0 device and we wish
# to create a bridge0 device:
#
# /etc/ifconfig.bridge0
# ------8<------8<------8<------8<------
# create
# !brconfig $int add bge0 stp bge0 up
# ------>8------>8------>8------>8------
#
#============================================================================

# Exit if anything goes wrong.
set -e

# First arg is the operation.
OP=$1; shift

# Pull variables in args into environment
for arg ; do export "${arg}" ; done

case $OP in
start|stop|status)
	# Do nothing
	;;
*)
	echo 'Invalid command: ' $OP  
	echo 'Valid commands are: start, stop, status'
	exit 1
	;;
esac

exit 0
