pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/xentools20 * Add modified scripts for NetBSD ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8dc206a06fa8
branches:  trunk
changeset: 500015:8dc206a06fa8
user:      xtraeme <xtraeme%pkgsrc.org@localhost>
date:      Sat Oct 01 02:10:10 2005 +0000

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

diffstat:

 sysutils/xentools20/Makefile              |  26 ++++++++--
 sysutils/xentools20/files/block-file-nbsd |  34 +++++++++++++
 sysutils/xentools20/files/vif-bridge-nbsd |  77 +++++++++++++++++++++++++++++++
 3 files changed, 131 insertions(+), 6 deletions(-)

diffs (180 lines):

diff -r 2f3380031b42 -r 8dc206a06fa8 sysutils/xentools20/Makefile
--- a/sysutils/xentools20/Makefile      Sat Oct 01 00:15:10 2005 +0000
+++ b/sysutils/xentools20/Makefile      Sat Oct 01 02:10:10 2005 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.20 2005/09/16 18:14:49 bouyer Exp $
+# $NetBSD: Makefile,v 1.21 2005/10/01 02:10:10 xtraeme Exp $
 #
 
 DISTNAME=              xen-2.0.7-src
 PKGNAME=               xentools20-2.0.7
-PKGREVISION=           3
+PKGREVISION=           4
 CATEGORIES=            sysutils
 MASTER_SITES=          http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/
 EXTRACT_SUFX=          .tgz
@@ -19,6 +19,8 @@
 
 ONLY_FOR_PLATFORM=     Linux-2.[46]*-i386 NetBSD-*-i386
 
+CONFLICTS+=            libxen-[0-9]*
+
 WRKSRC=                        ${WRKDIR}/xen-2.0/tools
 
 EGDIR=                 ${PREFIX}/share/examples/xen
@@ -74,10 +76,11 @@
 RCD_SCRIPTS=           xend
 FILES_SUBST+=          RCD_INTERPRETER=${PYTHONBIN}
 FILES_SUBST+=          PROCPATH=${PROCPATH}
+FILES_SUBST+=          PKG_SYSCONFDIR=${PKG_SYSCONFDIR}
 
 INSTALLATION_DIRS=     share/examples/xen
 
-XEND_SCRIPTS=          network vif-bridge block-enbd block-file        \
+XEND_SCRIPTS=          network block-enbd vif-bridge block-file \
                        xmexample1 xmexample2 xmexample3
 
 CONF_FILES=            ${EGDIR}/xend-config.sxp \
@@ -95,9 +98,20 @@
 post-install:
        ${INSTALL_DATA} ${WRKSRC}/examples/xend-config.sxp \
                ${EGDIR}/xend-config.sxp
-.for s in ${XEND_SCRIPTS}
-       ${INSTALL_DATA} ${WRKSRC}/examples/${s} ${EGDIR}/${s}
-.endfor
+.if ${OPSYS} == "Linux"
+.  for s in ${XEND_SCRIPTS}
+       ${INSTALL_SCRIPT} ${WRKSRC}/examples/${s} ${EGDIR}/${s}
+.  endfor
+.else
+.  for f in vif-bridge block-file
+       ${SED} -e "s|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g"      \
+               ${FILESDIR}/${f}-nbsd > ${WRKSRC}/${f}-nbsd
+       ${INSTALL_SCRIPT} ${WRKSRC}/${f}-nbsd ${EGDIR}/${f}
+.  endfor
+.  for f in ${XEND_SCRIPTS:S/vif-bridge//:S/block-file//}
+       ${INSTALL_SCRIPT} ${WRKSRC}/examples/${f} ${EGDIR}/${f}
+.  endfor
+.endif
 
 .include "../../lang/python/application.mk"
 .include "../../lang/python/extension.mk"
diff -r 2f3380031b42 -r 8dc206a06fa8 sysutils/xentools20/files/block-file-nbsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xentools20/files/block-file-nbsd Sat Oct 01 02:10:10 2005 +0000
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $NetBSD: block-file-nbsd,v 1.1 2005/10/01 02:10:10 xtraeme Exp $
+#
+# Usage: block_file [bind file|unbind node]
+#
+# 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.
+#
+# The node argument to unbind is the name of the device node we are to
+# unbind.
+
+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
+       ;;
+
+       unbind)
+               /usr/sbin/vnconfig -u $2
+               exit 0
+       ;;
+
+       *)
+               echo 'Unknown command: ' $1
+               echo 'Valid commands are: bind, unbind'
+               exit 1
+       ;;
+esac
diff -r 2f3380031b42 -r 8dc206a06fa8 sysutils/xentools20/files/vif-bridge-nbsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xentools20/files/vif-bridge-nbsd Sat Oct 01 02:10:10 2005 +0000
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# $NetBSD: vif-bridge-nbsd,v 1.1 2005/10/01 02:10:10 xtraeme Exp $
+#
+#============================================================================
+# @PKG_SYSCONFDIR@/vif-bridge
+#
+# Script for configuring a vif in bridged mode.
+# Xend calls a vif script when bringing a vif up or down.
+# This script is the default - but it can be configured for each vif.
+#
+# Example invocation:
+#
+# vif-bridge up domain=VM1 vif=xvif1.0 bridge=bridge0 ip="128.232.38.45/28 10.10.10.55/24"
+#
+#
+# Usage:
+# vif-bridge (up|down) {VAR=VAL}*
+#
+# Vars:
+#
+# domain  name of the domain the interface is on (required).
+# vif     vif interface name (required).
+# mac     vif MAC address (required).
+# bridge  bridge to add the vif to (required).
+# ip      list of IP networks for the vif, space-separated (optional).
+#
+# up:
+# Enslaves the vif interface to the bridge and adds iptables rules
+# for its ip addresses (if any).
+#
+# down:
+# Removes the vif interface from the bridge and removes the iptables
+# rules for its ip addresses (if any).
+#============================================================================
+
+# Exit if anything goes wrong
+set -e
+
+echo "vif-bridge $*"
+
+# Operation name.
+OP=$1
+shift
+
+# Pull variables in args into environment
+for arg ; do export "${arg}" ; done
+
+# Required parameters. Fail if not set.
+domain=${domain:?}
+vif=${vif:?}
+mac=${mac:?}
+bridge=${bridge:?}
+
+# Are we going up or down?
+case $OP in
+    up)
+        brcmd='add'
+        ;;
+    down)
+        brcmd='delete'
+        ;;
+    *)
+        echo 'Invalid command: ' $OP
+        echo 'Valid commands are: up, down'
+        exit 1
+        ;;
+esac
+
+# Don't do anything if the bridge is "null".
+if [ "${bridge}" = "null" ] ; then
+    exit
+fi
+
+# Add/remove vif to/from bridge.
+/sbin/brconfig ${bridge} ${brcmd} ${vif}
+/sbin/ifconfig ${vif} $OP



Home | Main Index | Thread Index | Old Index