commit 43c445e2fc85f01f1ab55ff32e036b2c23d0b418
parent b8597aecc1292d2b80d8a1aa5bebdd6fbbb79d7a
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date: Thu, 30 Sep 2010 21:28:52 +0200
man page and launch scripts
Diffstat:
6 files changed, 72 insertions(+), 59 deletions(-)
diff --git a/bin/9vxp b/bin/9vxp
@@ -1,21 +1,24 @@
#!/bin/sh
-# 9vxp: run a lib/profile like file at init
+# 9vxp: run commands from arg or file
# Reads configuration from ~/.9vxp.ini
-# Default root (can be changed with -r)
-root=${PLAN9VXROOT:=/usr/local/plan9vx}
-
fatal() { echo $* 1>&2; exit 1; }
abs() { f=$1
echo $f | grep -q '^/' || f=`pwd`/$f
ls $f || fatal $1 not found; }
+usage="usage: 9vxp profile [9vx options]"
+
+p=$1
+shift || fatal $usage
+test -f "$p" && p=". '#Z`abs $p`'"
+
+# Defaults
+root=${PLAN9VXROOT:=/usr/local/plan9vx}
+conf=${PLAN9VXCONF:=~/.9vxp.ini}
-test $# -gt 0 || fatal "usage: 9vxp profile [args]"
-profile="#Z"`abs $1`; shift
initprofile='. /rc/bin/termrc
home=/usr/$user; test -d $home && cd
- . $profile || reboot exit with errors: $status
+ '$p' || reboot exit with errors: $status
reboot'
-conf="~/.9vxp.ini"
test -f $conf && conf="-f $conf" || unset conf
-exec 9vx $conf -r $root $* -i "$initprofile" "profile=$profile"
+exec 9vx -r $root $conf "$@" -i "$initprofile"
diff --git a/bin/9vxtap b/bin/9vxtap
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-USERID=`whoami`
-
-# Default root (can be changed with -r)
-root=${PLAN9VXROOT:=/usr/local/plan9vx}
-
-# Create the tap device with tunctl
-IFACE=`sudo tunctl -b -u $USERID`
-# or openvpn
-#IFACE=tap0
-#sudo openvpn --mktun --dev $IFACE --user $USERID
-
-# Bring the tap device up
-sudo /sbin/ifconfig $IFACE 0.0.0.0 up
-
-# Add it to the bridge
-sudo /usr/sbin/brctl addif br0 $IFACE
-
-# Launch 9vx (use -F to not fork)
-9vx -F "ether0=type=tap dev=$IFACE" -r $root $*
-
-# Bring the tap device down and disconnect from br0
-sudo /sbin/ifconfig $IFACE down
-sudo /usr/sbin/brctl delif br0 $IFACE
-
-# Remove the tap device with tunctl
-sudo tunctl -d $IFACE &> /dev/null
-# or openvpn
-#sudo openvpn --rmtun --dev $1
diff --git a/bin/acmevx b/bin/acmevx
@@ -1,4 +1,4 @@
-#!/usr/bin/9vxp
+#!/home/yiyus/gsoc/vx32/bin/9vxp -f
# acmevx: stand in 9vx complex
mntgen
diff --git a/bin/rcvx b/bin/rcvx
@@ -5,7 +5,7 @@ cmd="/386/bin/bind -a /386/bin /bin;
bind -a /rc/bin /bin;
cd '#Z"`pwd`"';
prompt=\$sysname'# ';
- rc $*;
+ rc $@;
echo reboot > '#c/reboot'"
# double quotes in cmd to pass it to rc -c
cmd=`echo $cmd | sed "s;';'';g"`
diff --git a/bin/tap b/bin/tap
@@ -0,0 +1,33 @@
+#!/bin/sh
+# tap: set up/down a tap device
+
+fatal() { echo $* 1>&2; exit 1; }
+usage="usage: tap cmd [args]"
+
+cmd=$1
+shift || fatal $usage
+user=`whoami`
+
+# Create the tap device with tunctl
+iface=`sudo tunctl -b -u $user`
+# or openvpn
+#iface=tap0
+#sudo openvpn --mktun --dev $iface --user $user
+
+# Bring the tap device up
+sudo /sbin/ifconfig $iface 0.0.0.0 up
+
+# Add it to the bridge
+sudo /usr/sbin/brctl addif br0 $iface
+
+# Launch 9vx (use -F to not fork)
+$cmd "$@" -F "ether0=type=tap dev=$iface"
+
+# Bring the tap device down and disconnect from br0
+sudo /sbin/ifconfig $iface down
+sudo /usr/sbin/brctl delif br0 $iface
+
+# Remove the tap device with tunctl
+sudo tunctl -d $iface &> /dev/null
+# or openvpn
+#sudo openvpn --rmtun --dev $1
diff --git a/doc/9vx.1 b/doc/9vx.1
@@ -36,11 +36,6 @@
.I 9vx options
]
.PP
-.B 9vxtap
-[
-.I 9vx options
-]
-.PP
.B acmevx
[
.I 9vx options
@@ -50,6 +45,12 @@
[
.I rc(1) options
]
+.PP
+.B tap
+.I cmd
+[
+.I cmd options
+]
.SH DESCRIPTION
Plan 9 VX (or 9vx for short) is a port of the Plan 9 operating system to
run on top of commodity operating systems, allowing the use of both Plan
@@ -97,7 +98,7 @@ Setup a virtual ethernet device. Parameters take the default values
for tap and
.I dev=
for pcap (will look for the first one available) and
-,I addr=00:00:09:00:00:0x
+.I ea=00:00:09:00:00:0x
in both cases. If no device is configured the
network stack of the host system is used
.TP
@@ -114,10 +115,10 @@ after converting localroot to an absolute path in the host.
.B user
Set user name, the host system user is used by default
.PP
-Additional
+Other
.I var=value
-pairs are used to set environment variables before control is passed to
-boot(8). Some configuration values can be set directly using flags in
+arguments are used to set environment variables before control is passed
+to boot(8). Some configuration values can be set directly using flags in
the command line:
.I -i
sets
@@ -138,23 +139,29 @@ the system console. With
the gui will not be started.
.SS Booting 9vx
When started, 9vx will run a modified version of boot(8) which accepts
-additional root locations for the local boot method: local
-directories, iso images and bz2 files (a compressed file system /boot/rootfs.bz2 is
-included in the 9vx executable). Fossil and kfs partitions (possibly in a local file) can be used too, as well as the tcp boot method.
+additional root locations for the local boot method: local directories,
+iso images and bz2 files (a compressed file system /boot/rootfs.bz2 is
+included in the 9vx executable). Fossil and kfs partitions (possibly in
+a local file) ca
+n be used too, as well as the tcp boot method.
.SS Running 9vx
Some scripts are included with 9vx as example:
.I 9vxc
-boots a cpu sever and
+boots a cpu sever,
.I 9vxp
boots a terminal as if
.I profile
-was the lib/profile file.
-.I 9vxtap
-shows how to use the tap device.
+was the lib/profile file (where
+.I profile
+can be a file or rc(1) commands),
.I acmevx
-uses 9vxp to run acme(1) inside 9vx.
+uses 9vxp to run acme(1) inside 9vx,
.I rcvx
-directly runs rc(1) from the included rootfs.bz2 image.
+runs rc(1) from the included rootfs.bz2 image and
+.I tap
+adds a tap device before executing
+.I cmd
+(one of 9vx[cp]) and removes it when finished.
.SS Exiting 9vx
Reboot signals terminate 9vx execution. In particular, the reboot command
will exit printing its arguments to starndard error.