pkgsrc/sysutils/xentools20/files/block-file-nbsd
jlam 8e6f1ae3d1 * 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.
2005-11-08 00:47:35 +00:00

59 lines
1.1 KiB
Bash

#!/bin/sh
#
# $NetBSD: block-file-nbsd,v 1.2 2005/11/08 00:47:35 jlam Exp $
#
# Usage: block-file bind file
#
# The file argument is the path to the file to which a vnd(4) device
# will be bound.
#
# Usage: block-file unbind node
#
# The node argument is the name of the device node to unbind.
#
case "$1" in
bind)
FILE="$2"
# 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
# Configure the first free vnd(4) device.
for disk in $available_disks; do
eval status=\$$disk
if [ "$status" = "free" ] && \
vnconfig /dev/${disk}d $FILE >/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