wm: infra

Download patch

ref: 212ff22eb0a5f9334da5d19881a9da657fd40b58
parent: c7ff4b33c9240fc38791c0603c11f64425dde29c
author: mkf <mkf@cloud9p.org>
date: Wed Sep 20 11:35:27 EDT 2023

unix/emu: add emu script

--- /dev/null
+++ b/unix/emu
@@ -1,0 +1,40 @@
+#!/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