shithub: rc

ref: 4028a0b5f197066ef36281f45c8efbaaaf3dbe37
dir: /bin/vmxlinux/

View raw version
#!/bin/rc -e
rfork ne

vmid=`{awk '
BEGIN{
	i = 0
	while(system("test -e \''#X\''/" i+1) == 0)
		i++
	print i
}'}
fn clean{
	sleep 1
	for(i in '#X'/$vmid/ctl)
		echo quit > $i
}
fn sigexit{
	clean
}
fn sigint{
	clean
}

ver=6.1.21_1
mac=2ec3bc946389
n=ether0
M=3G
k=/tmp/vmx/vmlinuz-$ver
m=/tmp/vmx/initramfs-^$ver^.img
d=/dev/sdE0/data
#v=vesa:1920x1050
v=1024x768
c=('root=/dev/vda1')
if(test -d '#l1'){
	bind -aq '#l1' /net
	n=ether1
}
while(~ $1 -?){
	switch($1){
	case -d; d=$2; shift;
	case -e; d=($d -d $2); shift;
	case -k; k=$2; shift;
	case -l; psd listen || aux/listen;
	case -M; M=$2; shift;
	case -m; m=$2; shift;
	case -n; n=$2; shift;
	case -v; v=$2; shift;
	case --; break;
	case *
		echo usage: $0 [opts] [--] [more opts]
		exit usage
	}
	shift
}
echo $v | awk -Fx '
{
	gsub(".*:", "")
	print "resize -dx", $1+8, "-dy", $2+8
}' >/dev/wctl
echo scroll >/dev/wctl
vmx \
	-d $d \
	-M $M \
	-m $m \
	-n ea:$mac!$n \
	-v $v \
	$k \
	$c $*