File: install.sh

package info (click to toggle)
yorick 1.5.14-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,072 kB
  • ctags: 7,996
  • sloc: ansic: 75,932; cpp: 1,282; lisp: 1,225; sh: 1,025; makefile: 593; fortran: 19
file content (128 lines) | stat: -rwxr-xr-x 3,203 bytes parent folder | download | duplicates (2)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
# install.sh -- $Id$

# set Y_SITE, Y_HOME environment variables
if test -r Make.cfg; then
  eval `grep '^Y_SITE=' Make.cfg`
  eval `grep '^Y_HOME=' Make.cfg`
else
  echo install.sh: Make.cfg missing -- cannot install before make config
  exit 1
fi

home_only=no
un_install=no
case "$1" in
  +home) home_only=yes ;;
  -home) home_only=yes; un_install=yes ;;
  +both) ;;
  -both) un_install=yes ;;
  *) echo "install.sh: FATAL, damaged Makefile"; exit 1 ;;
esac

if test -n "$2"; then
  Y_SITE="$2$Y_SITE"
  Y_HOME="$2$Y_HOME"
fi

if test -n "$3"; then
  Y_BINDIR="$3"
else
  Y_BINDIR=$Y_HOME/bin
fi

if test -n "$4"; then
  Y_DOCDIR="$4"
  if test "$Y_DOCDIR" = /dev/null; then Y_DOCDIR=""; fi
else
  Y_DOCDIR=$Y_SITE/doc
fi

if test $un_install = yes; then
echo "********************* uninstalling architecture-dependent files from"
echo Y_HOME=$Y_HOME
rm -f $Y_HOME/junk.tst
touch ./junk.tst
if test -f $Y_HOME/junk.tst; then
  for sub in include lib bin; do rm -rf $Y_HOME/$sub; done
  rm -f $Y_HOME/Maketmpl $Y_HOME/Make.*
else
  rm -rf $Y_HOME
fi
rm -rf $Y_BINDIR/yorick
rm -rf $Y_BINDIR/gist
rm -f ./junk.tst

if test $home_only = yes; then exit 0; fi
echo "********************* uninstalling architecture-independent files from"
echo Y_SITE=$Y_SITE
rm -f $Y_SITE/junk.tst
touch ./junk.tst
if test -f $Y_SITE/junk.tst; then
  rm -rf $Y_SITE/man
else
  rm -rf $Y_SITE
fi
rm -f ./junk.tst
# note: this does not uninstall non-default Y_DOCDIR

else
echo "********************* installing architecture-dependent files to"
echo Y_HOME=$Y_HOME
if test ! -d $Y_HOME; then mkdir -p $Y_HOME; fi
if test ! -d $Y_HOME/include; then mkdir $Y_HOME/include; fi
if test ! -d $Y_HOME/lib; then mkdir $Y_HOME/lib; fi
if test -n "$3"; then
  if test ! -d $Y_BINDIR; then mkdir -p $Y_BINDIR; fi
else
  if test ! -d $Y_HOME/bin; then mkdir $Y_HOME/bin; fi
fi
cp -f play/unix/config.h play/*.h gist/*.h yorick/*.h $Y_HOME/include
touch ./junk.tst
if test -f $Y_HOME/junk.tst; then
  :
else
  cp -f Make.cfg $Y_HOME
fi
rm -f ./junk.tst
cp -f yorick/Maketmpl $Y_HOME
cp -f yorick/libyor.a yorick/main.o yorick/codger $Y_HOME/lib
eval `grep RANLIB= Make.cfg`
$RANLIB $Y_HOME/lib/libyor.a
if test -r drat/libdrat.a; then
  cp -f drat/libdrat.a $Y_HOME/lib;
  $RANLIB $Y_HOME/lib/libdrat.a
fi
if test -r hex/libhex.a; then
  cp -f hex/libhex.a $Y_HOME/lib;
  $RANLIB $Y_HOME/lib/libhex.a
fi
cp -f yorick/yorick $Y_BINDIR
cp -f gist/gist $Y_BINDIR

if test $home_only = yes; then exit 0; fi
echo "********************* installing architecture-independent files to"
echo Y_SITE=$Y_SITE

if test ! -d $Y_SITE; then mkdir -p $Y_SITE; fi
if test ! -d $Y_SITE/i; then mkdir $Y_SITE/i; fi
if test ! -d $Y_SITE/i0; then mkdir $Y_SITE/i0; fi
if test ! -d $Y_SITE/g; then mkdir $Y_SITE/g; fi
if test -n "$Y_DOCDIR"; then
  if test ! -d $Y_DOCDIR; then mkdir $Y_DOCDIR; fi
fi
rm -f $Y_SITE/junk.tst
touch ./junk.tst
if test -f $Y_SITE/junk.tst; then
  :
else
  cp -f i/*.i i/README $Y_SITE/i
  cp -f i0/*.i i0/README $Y_SITE/i0
  cp -f g/*.gs g/*.gp g/ps.ps g/README $Y_SITE/g
  if test -n "$Y_DOCDIR"; then
    cp -f doc/*.tex doc/*.ps doc/*.pdf doc/FILE_FORMATS doc/README doc/*.doc $Y_DOCDIR
  fi
fi
rm -f ./junk.tst

fi