shithub: rc

ref: ae16de57e6157c784d2857813c400c7a7dcb857b
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=5.18.19_1
mac=2ec3bc946389
n=ether0
M=2G
k=/tmp/vmx/vmlinuz-$ver
m=/tmp/vmx/initramfs-^$ver^.img
d=/dev/sdE0/data
v=vesa:1920x1050
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 $*