From: mats c. <ma...@us...> - 2006-02-07 15:35:26
|
Update of /cvsroot/jungerl/jungerl/lib/gtkNode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21527/src Modified Files: check_otp Log Message: redeveloped using Erlang's code:root_dir/0 and code:lib_dir/1; now works all the time, including when the "erl" command in the PATH is not in the Erlang installation hierarchy (e.g. on Debian, erl is in /usr/bin, whereas the Erlang root is /usr/lib/erlang) Index: check_otp =================================================================== RCS file: /cvsroot/jungerl/jungerl/lib/gtkNode/src/check_otp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- check_otp 1 Dec 2005 12:20:09 -0000 1.1 +++ check_otp 7 Feb 2006 15:04:10 -0000 1.2 @@ -1,52 +1,17 @@ #!/bin/bash -root1=`which erl` -if [ -n "root1" ]; then - root1=`dirname $root1` - root1=`dirname $root1` -else - root1="" -fi - -if [ -n "$OTP_ROOT" ]; then - root2=$OTP_ROOT -else - root2="" +if [ "$1" == "-root" -o "$1" == "" ]; then + erl -noinput -eval 'io:format("~s~n", [code:root_dir()]), halt(0).' fi -if [ "$root1" == "$root2" ]; then - roots=$root1 -else - roots="$root1 $root2" +if [ "$1" == "-ei" -o "$1" == "" ]; then + erl -noinput -eval \ + 'case code:lib_dir("erl_interface") of + {error, bad_name} -> + io:format("not found~n", []), + halt(1); + LibDir -> + io:format("~s~n", [LibDir]), + halt(0) + end.' fi - -for r in $roots - do - for root in `dirname $r`/* - do - if [ -d $root/lib/erlang/lib ]; then - dir=$root/lib/erlang/lib - vsn=`basename $dir/erl_interface* | cut -f2 -d"-" ` - ei=$dir/erl_interface-$vsn - if [ `echo $vsn | cut -f1 -d"."` -ge 3 -a \ - `echo $vsn | cut -f2 -d"."` -ge 5 -a \ - -f $root/bin/erlc ]; then - ROOT=$root - EI=$ei - fi - elif [ -d $root/lib ]; then - dir=$root/lib - vsn=`basename $dir/erl_interface* | cut -f2 -d"-"` - ei=$dir/erl_interface-$vsn - if [ `echo $vsn | cut -f1 -d"."` -ge 3 -a \ - `echo $vsn | cut -f2 -d"."` -ge 5 -a \ - -f $root/bin/erlc ]; then - ROOT=$root - EI=$ei - fi - fi - done -done - -if [ "$1" == "-root" -o "$1" == "" ]; then echo $ROOT; fi -if [ "$1" == "-ei" -o "$1" == "" ]; then echo $EI; fi |