pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/xentools20 Improve the block-file-nbsd script...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9d598fcb1406
branches:  trunk
changeset: 511627:9d598fcb1406
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Apr 18 15:29:36 2006 +0000

description:
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.

diffstat:

 sysutils/xentools20/Makefile              |   4 ++--
 sysutils/xentools20/files/block-file-nbsd |  19 +++++++++++++++----
 2 files changed, 17 insertions(+), 6 deletions(-)

diffs (64 lines):

diff -r a9c1f44b2ae6 -r 9d598fcb1406 sysutils/xentools20/Makefile
--- a/sysutils/xentools20/Makefile      Tue Apr 18 15:21:44 2006 +0000
+++ b/sysutils/xentools20/Makefile      Tue Apr 18 15:29:36 2006 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.25 2006/02/05 23:10:57 joerg Exp $
+# $NetBSD: Makefile,v 1.26 2006/04/18 15:29:36 jlam Exp $
 #
 
 DISTNAME=              xen-2.0.7-src
 PKGNAME=               xentools20-2.0.7
-PKGREVISION=           6
+PKGREVISION=           7
 CATEGORIES=            sysutils
 MASTER_SITES=          http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/
 EXTRACT_SUFX=          .tgz
diff -r a9c1f44b2ae6 -r 9d598fcb1406 sysutils/xentools20/files/block-file-nbsd
--- a/sysutils/xentools20/files/block-file-nbsd Tue Apr 18 15:21:44 2006 +0000
+++ b/sysutils/xentools20/files/block-file-nbsd Tue Apr 18 15:29:36 2006 +0000
@@ -1,11 +1,15 @@
 #!/bin/sh
 #
-# $NetBSD: block-file-nbsd,v 1.2 2005/11/08 00:47:35 jlam Exp $
+# $NetBSD: block-file-nbsd,v 1.3 2006/04/18 15:29:36 jlam Exp $
 #
-# Usage: block-file bind file
+# Usage: block-file bind file [flags]
 #
 #    The file argument is the path to the file to which a vnd(4) device
-#    will be bound.
+#    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
 #
@@ -15,6 +19,7 @@
 case "$1" in
 bind)
        FILE="$2"
+       FLAGS="$3"
 
        # Store the list of available vnd(4) devices in ``available_disks'',
        # and mark them as ``free''.
@@ -33,11 +38,17 @@
                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" ] && \
-                  vnconfig /dev/${disk}d $FILE >/dev/null; then
+                  eval $vnconfig_cmd >/dev/null; then
                        echo /dev/${disk}d
                        exit 0
                fi



Home | Main Index | Thread Index | Old Index