~fultonbrowne/ninebox

5f8520d1bcc4d9d4e1101ec44830c91aa3003a3e — glenda a month ago
init commit
4 files changed, 92 insertions(+), 0 deletions(-)

A 9boxrc
A README
A namespace.9box.default
A start
A  => 9boxrc +8 -0
@@ 1,8 @@
#! /bin/rc -e
fn run {
	echo test
}
run &
hubname=9box.$pid
hub -b $hubname
echo to get a shell run: hub $hubname 

A  => README +2 -0
@@ 1,2 @@
# Plan9 containers
Just trust me - it will be great
\ No newline at end of file

A  => namespace.9box.default +40 -0
@@ 1,40 @@
# root
mount -ac #s/$nsroot /root $rootspec
bind -a $rootdir /

# kernel devices
bind #c /dev
bind #d /fd
bind -c #e /env
bind #p /proc
bind -c #s /srv
bind -q #σ /shr
bind -a #¤ /dev
bind -qa #¶ /dev

# authentication
mount -b /srv/factotum /mnt

# mount points
mount -a /srv/slashn /n
mount -a /srv/slashmnt /mnt
mount -a /srv/mntexport /mnt/exportfs

# standard bin
bind /$cputype/bin /bin
bind -a /rc/bin /bin

# internal networks
# mount -a /srv/ip /net
bind -a #l /net
bind -a #I /net
mount -a /srv/cs /net
mount -a /srv/dns /net
mount -a /srv/net /net

bind -c /usr/$user/tmp /tmp
cd /usr/$user

. /lib/namespace.local
. /lib/namespace.$sysname
. /cfg/$sysname/namespace

A  => start +42 -0
@@ 1,42 @@
#!/bin/rc
# TODO get nsfile with -n
nsfile=/lib/namespace.9box.default
# TODO set start command with -c
command=9boxrc

while(! ~ $#* 1) {
	switch ($1) {
	case -n
		nsfile=$2
		shift
	case -c
		command=$2
		shift
#	case -w
#		wflags='-w'
	case -*
		echo Usage: 9box/start [-n nsfile] [-c command] srvfile [authagent]
		exit usage
	}
	shift
}
nsroot=$1
if(~ $2 ?*){
	authagent=$2
}
if not if(! ~ $authagent ?*){
	authagent=factotum
}
if(! test -e /srv/$authagent){
	factotum -s $authagent
}

if(! test -e /srv/$1){
	srv tcp!$1!564 $1
	if(! test -e /srv/$1){
		echo srv $1 couldnt be acquired
		exit no.srv
	}
}

auth/newns -n $nsfile $command