File: octinst.sh.in

package info (click to toggle)
octave2.9-forge 2006.07.09%2Bdfsg1-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 14,628 kB
  • ctags: 4,676
  • sloc: cpp: 41,951; perl: 2,789; sh: 1,615; makefile: 1,379; lex: 1,219; ansic: 1,098; tcl: 799; objc: 211; fortran: 16
file content (93 lines) | stat: -rwxr-xr-x 2,779 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#! /bin/sh

# octinst.sh source mpath opath xpath [altmpath altopath]

# Copies all m-files and oct-files from the source directory to the
# mpath and opath respectively.  Preserves links.  Files in
# source/data are copied to mpath.  Files in the source/bin are copied
# to xpath. m-files and oct-files in source/alternatives are copied to 
# altmpath and altopath respectively

if test $# -lt 4 ; then
    echo 'Not enough arguments'
    exit 1
fi

# interpret input parameters
source=$1; shift
mpath=$1; shift
opath=$1; shift
xpath=$1; shift
if test $# -ge 1; then altmpath=$1; shift; fi
if test $# -ge 1; then altopath=$1; shift; fi
INSTALL="@INSTALL@"
INSTALL_DATA="@INSTALL_DATA@"
INSTALL_PROGRAM="@INSTALL_PROGRAM@"
INSTALL_SCRIPT="@INSTALL_SCRIPT@"
MKPKGADD="@TOPDIR@/admin/mkpkgadd"
COPY_FLAGS="@COPY_FLAGS@"

# grab the m-files
files=`echo $source/*.m`
if test "$files" != "$source/*.m" ; then
    $INSTALL -d $mpath
    $INSTALL_DATA $files $mpath
fi

# grab the oct-files
files=`echo $source/*.oct`
if test "$files" != "$source/*.oct" ; then
    $INSTALL -d $opath
## Grrr... install doesn't preserve links.  Hope this works.
    cp $COPY_FLAGS $files $opath
fi

# install alternatives
if test -d "$source/alternatives" ; then
    # m-files
    files=`echo $source/alternatives/*.m`
    if test "$files" != "$source/alternatives/*.m" ; then
        $INSTALL -d $altmpath
	$INSTALL_DATA $files $altmpath
    fi
    # oct-files
    files=`echo $source/alternatives/*.oct`
    if test "$files" != "$source/alternatives/*.oct" ; then
        $INSTALL -d $altopath
	$INSTALL_DATA $files $altopath
    fi
fi

# Create PKG_ADD, and destroy it immediately if it is empty
# XXX FIXME XXX no PKG_ADD created if only oct-files and no m-files.
if test -d "$mpath" ; then
    $MKPKGADD $source > $mpath/PKG_ADD
    if test -z "`cat $mpath/PKG_ADD`" ; then rm -f $mpath/PKG_ADD;  fi
fi
# PKG_ADD for alternatives
if test -d "$source/alternatives" -a -d "$altmpath" ; then
    $MKPKGADD $source/alternatives > $altmpath/PKG_ADD
    if test -z "`cat $altmpath/PKG_ADD`" ; then rm $altmpath/PKG_ADD; fi
fi

# grab the data files, skipping the CVS directory
files=`echo $source/data/* | sed -e "s/[^ ]*CVS//"`
if test -n "$files" -a "$files" != "$source/data/*" ; then
    $INSTALL -d $mpath
    $INSTALL_DATA $files $mpath
fi

# grab the executable files, skipping the CVS directory
files=`echo $source/bin/* | sed -e "s/[^ ]*CVS//"`
if test -n "$files" -a "$files" != "$source/bin/*" ; then
    $INSTALL -d $xpath
    $INSTALL_PROGRAM $files $xpath
fi

# grab the script files, skipping the CVS directory
files=`echo $source/scripts/* | sed -e "s/[^ ]*CVS//"`
if test -n "$files" -a "$files" != "$source/scripts/*" ; then
    $INSTALL -d $xpath
    $INSTALL_SCRIPT $files $xpath
fi