diff options
author | xtraeme <xtraeme> | 2005-10-01 02:10:10 +0000 |
---|---|---|
committer | xtraeme <xtraeme> | 2005-10-01 02:10:10 +0000 |
commit | 906cb086f9396cf03b5bae60890372a3fbdcfaf9 (patch) | |
tree | 6c171dd1ff0d7385bec1e6d29da7752b6cd99697 /sysutils/xentools20 | |
parent | 6548b316d6e0d1529d6a81f5f4ad5785549f18ca (diff) | |
download | pkgsrc-906cb086f9396cf03b5bae60890372a3fbdcfaf9.tar.gz |
* 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 (limited to 'sysutils/xentools20')
-rw-r--r-- | sysutils/xentools20/Makefile | 26 | ||||
-rw-r--r-- | sysutils/xentools20/files/block-file-nbsd | 34 | ||||
-rw-r--r-- | sysutils/xentools20/files/vif-bridge-nbsd | 77 |
3 files changed, 131 insertions, 6 deletions
diff --git a/sysutils/xentools20/Makefile b/sysutils/xentools20/Makefile index 270f151cbcc..f6298c0ea4f 100644 --- a/sysutils/xentools20/Makefile +++ b/sysutils/xentools20/Makefile @@ -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 @@ PKG_SYSCONFSUBDIR= xen 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 @@ PROCPATH= /proc 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 @@ pre-build: 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 --git a/sysutils/xentools20/files/block-file-nbsd b/sysutils/xentools20/files/block-file-nbsd new file mode 100644 index 00000000000..65eb5630fe1 --- /dev/null +++ b/sysutils/xentools20/files/block-file-nbsd @@ -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 --git a/sysutils/xentools20/files/vif-bridge-nbsd b/sysutils/xentools20/files/vif-bridge-nbsd new file mode 100644 index 00000000000..1f0a6110dd2 --- /dev/null +++ b/sysutils/xentools20/files/vif-bridge-nbsd @@ -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 |