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 |
379
|
52 chmod 755 $d |
5
|
53 fi |
|
54 done |
379
|
55 chmod 755 $prefix/lib |
|
56 chmod 755 $prefix/lib/octave |
5
|
57 |
|
58 if test "$prefix" = /usr/local ; then |
|
59 echo "installing ./octave as $bindir/octave" |
|
60 cp ./octave $bindir/octave |
|
61 chmod 755 $bindir/octave |
|
62 else |
|
63 echo "installing octave.sh as $bindir/octave" |
|
64 sed "s|@OCTAVE_HOME@|$prefix|" octave.sh > octave.tmp |
|
65 cp octave.tmp $bindir/octave |
|
66 chmod 755 $bindir/octave |
|
67 |
|
68 echo "installing ./octave as $bindir/octave.bin" |
|
69 cp ./octave $bindir/octave.bin |
|
70 chmod 755 $bindir/octave.bin |
|
71 fi |
|
72 |
|
73 echo "installing M-files in $libsubdir" |
|
74 for f in scripts/*.m ; do |
|
75 file=`basename $f` |
|
76 echo $file |
|
77 cp $f $libsubdir/$file |
|
78 chmod 644 $libsubdir/$file |
|
79 done |
|
80 |
|
81 echo "installing info files in $infodir" |
|
82 for f in doc/octave.info* ; do |
|
83 file=`basename $f` |
|
84 echo $file |
|
85 cp $f $infodir/$file |
|
86 chmod 644 $infodir/$file |
|
87 done |
|
88 |
|
89 exit 0 |