#!/bin/sh
verbose=false
ROOT="/usr/local/inferno"
EMU=""
OBJTYPE=`uname -m | sed '
s;i.86;386;;
s;i86pc;386;;
s;amd64;x86_64;;
s;/.*;;; s; ;;g;
s;armv4l;arm;g;
s;PowerMacintosh;power;g;
s;macppc;power;g;
s;ppc64;power;g;
s;ppc;power;g;
'`
SYSNAME=`uname | sed 's;Darwin;MacOSX;;'`
USR=`basename $HOME`
cmd=""
emuargs=""
while [ "x$1" != "x" ]
do
case $1 in
-[gcmpf]*)
emuargs="$emuargs $1"
;;
-[d7sS])
emuargs="$emuargs $1"
;;
-C)
emuargs="$emuargs $1 $2"
shift
;;
-[r]*)
ROOT=`echo $1 | sed 's/-r//'`
;;
-v)
emuargs="$emuargs $1"
verbose=true
;;
*)
cmd="$@"
shift $#
break
;;
esac
shift
done
EMUBIN=$ROOT/$SYSNAME/$OBJTYPE/bin
CWD=`pwd`
if $verbose; then
echo "emuargs: $emuargs"
echo "cmd: $cmd"
echo "cwd: $CWD"
echo "exec $EMUBIN/emu -r$ROOT $emuargs"
fi
exec "$EMUBIN/emu" -r"$ROOT" $emuargs /dis/sh.dis -nc "{
mount -ac {mntgen} /usr
bind -bc '#U*$HOME' /usr/$USR
bind -bc '#U*' /n/local
cd /n/local/$CWD
$cmd
r=$status
echo halt > /dev/sysctl
exit $r
}"
|