Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/dis.sh

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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
}"

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.