5
|
1 #!/bin/sh |
|
2 # |
|
3 # doinstall.sh -- install script for binary distributions. |
|
4 # |
|
5 # John W. Eaton |
|
6 # jwe@che.utexas.edu |
|
7 # Department of Chemical Engineering |
|
8 # The University of Texas at Austin |
|
9 |
|
10 prefix=/usr/local |
|
11 if test $# -eq 1 ; then |
|
12 prefix=$1 |
|
13 else |
|
14 if test $# -gt 1 ; then |
|
15 echo "usage: doinstall.sh [prefix-directory]" |
|
16 exit 1 |
|
17 fi |
|
18 fi |
|
19 |
|
20 # ask octave to tell us the version number |
|
21 version=`./octave -v 2>/dev/null | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q` |
|
22 |
|
23 if test -z "$version" ; then |
|
24 echo "doinstall.sh: unable to extract version number from Octave!" |
|
25 exit 1 |
|
26 fi |
|
27 |
|
28 # where to install binaries. |
|
29 bindir=$prefix/bin |
|
30 |
|
31 # where to install M-files |
|
32 libsubdir=$prefix/lib/octave/$version |
|
33 |
|
34 # where to install Info files |
|
35 infodir=$prefix/info |
|
36 |
|
37 cat << EOF |
|
38 Installing octave in subdirectories of $prefix: |
|
39 |
|
40 Binaries: $bindir |
|
41 M-files: $libsubdir |
|
42 Info files: $infodir |
|
43 |
|
44 EOF |
|
45 |
|
46 for d in $bindir $libsubdir $infodir ; do |
|
47 if test -d $d ; then |
|
48 true |
|
49 else |
|
50 echo "making $d" |
|
51 ./mkpath $d |
|
52 fi |
|
53 done |
|
54 |
|
55 if test "$prefix" = /usr/local ; then |
|
56 echo "installing ./octave as $bindir/octave" |
|
57 cp ./octave $bindir/octave |
|
58 chmod 755 $bindir/octave |
|
59 else |
|
60 echo "installing octave.sh as $bindir/octave" |
|
61 sed "s|@OCTAVE_HOME@|$prefix|" octave.sh > octave.tmp |
|
62 cp octave.tmp $bindir/octave |
|
63 chmod 755 $bindir/octave |
|
64 |
|
65 echo "installing ./octave as $bindir/octave.bin" |
|
66 cp ./octave $bindir/octave.bin |
|
67 chmod 755 $bindir/octave.bin |
|
68 fi |
|
69 |
|
70 echo "installing M-files in $libsubdir" |
|
71 for f in scripts/*.m ; do |
|
72 file=`basename $f` |
|
73 echo $file |
|
74 cp $f $libsubdir/$file |
|
75 chmod 644 $libsubdir/$file |
|
76 done |
|
77 |
|
78 echo "installing info files in $infodir" |
|
79 for f in doc/octave.info* ; do |
|
80 file=`basename $f` |
|
81 echo $file |
|
82 cp $f $infodir/$file |
|
83 chmod 644 $infodir/$file |
|
84 done |
|
85 |
|
86 exit 0 |