head	1.4;
access;
symbols
	pkgsrc-2014Q1:1.3.0.68
	pkgsrc-2014Q1-base:1.3
	pkgsrc-2013Q4:1.3.0.66
	pkgsrc-2013Q4-base:1.3
	pkgsrc-2013Q3:1.3.0.64
	pkgsrc-2013Q3-base:1.3
	pkgsrc-2013Q2:1.3.0.62
	pkgsrc-2013Q2-base:1.3
	pkgsrc-2013Q1:1.3.0.60
	pkgsrc-2013Q1-base:1.3
	pkgsrc-2012Q4:1.3.0.58
	pkgsrc-2012Q4-base:1.3
	pkgsrc-2012Q3:1.3.0.56
	pkgsrc-2012Q3-base:1.3
	pkgsrc-2012Q2:1.3.0.54
	pkgsrc-2012Q2-base:1.3
	pkgsrc-2012Q1:1.3.0.52
	pkgsrc-2012Q1-base:1.3
	pkgsrc-2011Q4:1.3.0.50
	pkgsrc-2011Q4-base:1.3
	pkgsrc-2011Q3:1.3.0.48
	pkgsrc-2011Q3-base:1.3
	pkgsrc-2011Q2:1.3.0.46
	pkgsrc-2011Q2-base:1.3
	pkgsrc-2011Q1:1.3.0.44
	pkgsrc-2011Q1-base:1.3
	pkgsrc-2010Q4:1.3.0.42
	pkgsrc-2010Q4-base:1.3
	pkgsrc-2010Q3:1.3.0.40
	pkgsrc-2010Q3-base:1.3
	pkgsrc-2010Q2:1.3.0.38
	pkgsrc-2010Q2-base:1.3
	pkgsrc-2010Q1:1.3.0.36
	pkgsrc-2010Q1-base:1.3
	pkgsrc-2009Q4:1.3.0.34
	pkgsrc-2009Q4-base:1.3
	pkgsrc-2009Q3:1.3.0.32
	pkgsrc-2009Q3-base:1.3
	pkgsrc-2009Q2:1.3.0.30
	pkgsrc-2009Q2-base:1.3
	pkgsrc-2009Q1:1.3.0.28
	pkgsrc-2009Q1-base:1.3
	pkgsrc-2008Q4:1.3.0.26
	pkgsrc-2008Q4-base:1.3
	pkgsrc-2008Q3:1.3.0.24
	pkgsrc-2008Q3-base:1.3
	cube-native-xorg:1.3.0.22
	cube-native-xorg-base:1.3
	pkgsrc-2008Q2:1.3.0.20
	pkgsrc-2008Q2-base:1.3
	cwrapper:1.3.0.18
	pkgsrc-2008Q1:1.3.0.16
	pkgsrc-2008Q1-base:1.3
	pkgsrc-2007Q4:1.3.0.14
	pkgsrc-2007Q4-base:1.3
	pkgsrc-2007Q3:1.3.0.12
	pkgsrc-2007Q3-base:1.3
	pkgsrc-2007Q2:1.3.0.10
	pkgsrc-2007Q2-base:1.3
	pkgsrc-2007Q1:1.3.0.8
	pkgsrc-2007Q1-base:1.3
	pkgsrc-2006Q4:1.3.0.6
	pkgsrc-2006Q4-base:1.3
	pkgsrc-2006Q3:1.3.0.4
	pkgsrc-2006Q3-base:1.3
	pkgsrc-2006Q2:1.3.0.2
	pkgsrc-2006Q2-base:1.3
	pkgsrc-2006Q1:1.2.0.4
	pkgsrc-2006Q1-base:1.2
	pkgsrc-2005Q4:1.2.0.2
	pkgsrc-2005Q4-base:1.2;
locks; strict;
comment	@# @;


1.4
date	2014.05.25.15.35.35;	author gdt;	state dead;
branches;
next	1.3;
commitid	tewNFjYS9AE4YVBx;

1.3
date	2006.04.18.15.29.36;	author jlam;	state Exp;
branches;
next	1.2;

1.2
date	2005.11.08.00.47.35;	author jlam;	state Exp;
branches;
next	1.1;

1.1
date	2005.10.01.02.10.10;	author xtraeme;	state Exp;
branches;
next	;


desc
@@


1.4
log
@Remove xentools20.
@
text
@#!/bin/sh
#
# $NetBSD: block-file-nbsd,v 1.3 2006/04/18 15:29:36 jlam Exp $
#
# Usage: block-file bind file [flags]
#
#    The file argument is the path to the file to which a vnd(4) device
#    will be bound.  The flags argument is an optional block of flags
#    to modify how the file is bound to the vnd(4) device.  The valid
#    flags are:
#
#	r	bind the file as read-only
#
# Usage: block-file unbind node
#
#    The node argument is the name of the device node to unbind.
#

case "$1" in
bind)
	FILE="$2"
	FLAGS="$3"

	# Store the list of available vnd(4) devices in ``available_disks'',
	# and mark them as ``free''.
	#
	list=`/bin/ls -1 /dev/vnd[0-9]*d | sed "s,/dev/vnd,,;s,d,," | sort -n`
	for i in $list; do
		disk="vnd$i"
		available_disks="$available_disks $disk"
		eval $disk=free
	done

	# Mark the used vnd(4) devices as ``used''.
	for disk in `sysctl hw.disknames`; do
		case $disk in
		vnd[0-9]*) eval $disk=used ;;
		esac
	done

	vnconfig_flags=
	case "$FLAGS" in
	*r*)	vnconfig_flags="$vnconfig_flags -r" ;;
	esac

	# Configure the first free vnd(4) device.
	for disk in $available_disks; do
		eval status=\$$disk
		vnconfig_cmd="vnconfig $vnconfig_flags /dev/${disk}d $FILE"
		if [ "$status" = "free" ] && \
		   eval $vnconfig_cmd >/dev/null; then
			echo /dev/${disk}d
			exit 0
		fi
	done
	exit 1
	;;

unbind)
	NODE="$2"
	vnconfig -u $NODE
	exit 0
	;;

*)
	echo "Unknown command: $1"
	echo "Valid commands are: bind, unbind"
	exit 1
	;;
esac
@


1.3
log
@Improve the block-file-nbsd script slightly so that it's possible to
force a read-only bind of the image file to a vnd(4) device.  Bump
the PKGREVISION.
@
text
@d3 1
a3 1
# $NetBSD: block-file-nbsd,v 1.2 2005/11/08 00:47:35 jlam Exp $
@


1.2
log
@* Add a MESSAGE file with helpful information for NetBSD domain0
  installations.

* Modify the package to not install all of the configuration files with
  the execute bit set -- only install the helper scripts that way.

* Update the block-file-nbsd script to not blindly try to configure (and
  often fail to configure) every vnd(4) device until it finds one that
  works.  We now just determine what the next free vnd(4) device is and
  configure it directly.

* Add a netbsd-nbsd script that avoids trying to do all the Linux-specific
  that just filled the log files with garbage on NetBSD.

* Update the vif-bridge-nbsd script to check that the bridge device is
  configured before using it.

* Add clear comments at the top of scripts that can be customized so that
  the user has enough information to know how to do the customization.

* Add a xendomains rc.d script that can be used to start and stop guest
  domains at system boot- or shutdown-time.

Bump the PKGREVISION to 5.
@
text
@d3 1
a3 1
# $NetBSD$
d5 1
a5 1
# Usage: block-file bind file
d8 5
a12 1
#    will be bound.
d22 1
d41 5
d49 1
d51 1
a51 1
		   vnconfig /dev/${disk}d $FILE >/dev/null; then
@


1.1
log
@* Add modified scripts for NetBSD (block-file and vif-bridge) from
  Ceri Storey via port-xen@@, previous scripts were only useful for
  Linux.
* Install the scripts with INSTALL_SCRIPT not INSTALL_DATA.

Bump PKGREVISION.
@
text
@d5 1
a5 1
# Usage: block_file [bind file|unbind node]
d7 2
a8 2
# The file argument to the bind command is the file we are to bind to a
# vnd device.  We print the path to the vnd device node to stdout.
d10 25
a34 2
# The node argument to unbind is the name of the device node we are to
# unbind.
d36 10
a45 9
case $1 in
	bind)
		for dev in /dev/vnd?d; do
			if /usr/sbin/vnconfig $dev $2; then
				echo $dev
				exit 0
			fi
		done
		exit 1
d48 4
a51 3
	unbind)
		/usr/sbin/vnconfig -u $2
		exit 0
d54 4
a57 4
	*)
		echo 'Unknown command: ' $1
		echo 'Valid commands are: bind, unbind'
		exit 1
@

