wm: infra

ref: fb35068222c5b2d1c363fa73396685fa99a79455
dir: /unix/emu/

View raw version
#!/bin/ksh

vdir=/run # running clones
bdir=/base # base images dir

case $USER in
3|v8 )
	system=vax780 ;;
v1|v5|v7 )
	system=pdp11 ;;
43 )
	system=vax ;;
*)
	echo system is undefined, please notify me to update it.
	exit
esac

if ! [ -d $vdir ]; then
	echo $vdir: no such file or directory
	exit 2
fi
if ! [ -d $bdir ]; then
	echo $bdir: no such file or directory
	exit 2
fi

if [ -d $vdir/0 ]; then # something is running
	last_instance=`ls $vdir | sort -n | tail -1`
	new_instance=$((($last_instance+1)))
else # nothing is running?
	new_instance=0
fi

# create a clone
cp -r $bdir $vdir/$new_instance

cd $vdir/$new_instance #simh expects files to be on cwd
simh-$system $USER.ini
rm -rf $vdir/$new_instance
exit