Subject: Re: shell scripts in an emulation environment
To: Bill Studenmund <>
From: Brian Buhrow <>
List: tech-kern
Date: 01/28/1998 08:26:21
	Why not just put a case statement in the shell script which is
executed which maps NetBSD to Linux?  Then all the same variables would get
set, and you actually could do without the /emul directory altogether
except for the neded compatibility devices and libraries.  My strategy is
usually to put as little as possible in the emul directories and use the
standard paths except when there is an actual conflict.  Why would that not
work in this case?
On Jan 27,  8:59pm, Bill Studenmund wrote:
} Subject: shell scripts in an emulation environment
} 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
} support.
} 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,
} Bill
>-- End of excerpt from Bill Studenmund