summaryrefslogtreecommitdiff
path: root/support/SQLTeX/install
blob: 8361a3f21561ffb35d407b45183bda1dbc169577 (plain)
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
#!/bin/sh

SRCF="SQLTeX.pl"
TMPF="SQLTeX.tmp"
SQLT="SQLTeX"
RFIL="SQLTeX_r.dat"
CFIL="SQLTeX.cfg"
TAB="\011"

PI=`which perl` || PI=""

## Is Perl installed ?
if test -z "$PI"
then
   echo "Perl is either not installed on this system, or not included in your path"
   echo "Please check and correct this error - you need Perl to use SQLTeX"
   exit
fi

## Does the source file exist ?
if ! test -f $SRCF
then
   echo "Error - the file $SRCF does not exist in the current directory"
   exit
fi

## Where should SQLTeX be installed ?
CUSR=`whoami`
if test $CUSR = "root"
then
   DDIR="/usr/local/bin"
else
   DDIR=`pwd`
fi
while test -z "$IDIR"
do
   echo -n "Where should SQLTeX be installed [$DDIR] ? "
   read IDIR
   if test -z "$IDIR"
   then
      IDIR="$DDIR"
   fi
   if ! test -d $IDIR
   then
      echo "$IDIR does not exist or is not a directory"
      IDIR=""
   fi
done

echo "#!$PI -w" > $TMPF
echo "" >> $TMPF
cat $SRCF >> $TMPF
chmod +x $TMPF
mv $TMPF $IDIR/$SQLT

## Replacement file
if ! test -e $IDIR/$RFIL
then
	mv $RFIL $IDIR/$RFIL
fi

## Configuration file
if ! test -e $IDIR/$CFIL
then
	mv $CFIL $IDIR/$CFIL
fi

echo "Installation complete---type $SQLT -h for help"