Subject: shell scripts in an emulation environment
To: None <tech-kern@NetBSD.ORG>
From: Bill Studenmund <>
List: tech-kern
Date: 01/27/1998 20:59:39
We're having problems running Matlab cleanly in an emulation environment.

Matlab is a matrix manipulation and mathematics package used a lot in
engineering settings. It is not available as a NetBSD binary. It is
available for SunOS, Solaris, ULTRIX, and Linux.

The problem is that the canonical way to start matlab is to run the
"matlab" shell script, which figures out the machine architecture from
/bin/uname and looks for licence data files. It does this so multiple
architectures can be served from one directory hierarchy (most of the
weight is in matlab script files).

My intuition is to stick matlab's directories in
/emul/OS/usr/local/matlab, where we'd normally have it (OS == ULTRIX or
Linux). We can set $PATH to find it. 

The problem is that it for normal NetBSD users, it ends up being run by
NetBSD's /bin/sh.  I'd prefer the matlab script be run by /emul/OS/bin/sh.
That way matlab will find it's license data, and will also get the right
uname (or something patched to work right :-) 

Is there an easy way to do this, other than hacking the script to exec
/emul/OS/bin/sh? I'd prefer not as then we destroy the multi-architecture

My thought was that we could make execve notice that the path name started
with "/emul/". When the path does, it first looks for an interpriter name
prefixed with "/emul/OS/". If it doesn't find it, it just tries the
interpriter's name.

Looking at the source, basically my idea is to get the check_exec call
made within exec_script_makecmds to try "/emul/OS/"+interp. name, then
just interp. name.

What would this take? Or is there another way?

Take care,