Monday February 04, 2008 I wanted a single ~/bin in my home dir that could cope with 32 vs 64 and SPARC vs x86 and also allow me to have CPU capability variants as well, ie sparcv9+vis2 and a generic sparcv8 variant. So I rewrote isaexec as a simple shell script, I don't know how long ago I did this but it was probably some time during Solaris 7 development (which is when isaexec first appeared), anyway below is the shell script. I have subdirs in ~/bin for each cpu/architecture and all the binaries are links to ~/bin/isaexec.sh
#!/bin/ksh
fname=`basename $0`
pathname=`dirname $0`
if [ ! -x /usr/bin/isalist ]; then
arch=`arch`
if [ ! -x $pathname/$arch/$fname ]; then
echo "$0: cannot find the ISA list";
else
exec $pathname/$arch/$fname
echo "$0: cannon find/execute $fname in ISA subdirectories"
fi
fi
for isa in `/usr/bin/isalist` ; do
execpath="${pathname}/${isa}/${fname}"
if [ -x $execpath ]; then
exec $execpath "$@"
echo "$0 exec $execpath failed"
fi
done
echo "$0: cannon find/execute $fname in ISA subdirectories"
exit 1;
This far from perfect shell script from a performance view point and could probably use much more shell builtin functionality if ksh (or ksh93) was used instead.
( Feb 04 2008, 01:08:22 PM GMT ) Permalink Comments [1]