forked from gambit/gambit
/
InstallationCheck.in
70 lines (53 loc) · 1.66 KB
/
InstallationCheck.in
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
#! /bin/sh
# Copyright (c) 1994-2009 by Marc Feeley, All Rights Reserved.
PROGRAMS="@PROGRAMS@"
LIBRARIES="@LIBRARIES@"
INCLUDES="@INCLUDES@"
BIN_DIR="@BIN_DIR@"
LIB_DIR="@LIB_DIR@"
INCLUDE_DIR="@INCLUDE_DIR@"
INSTALL_DIR="@INSTALL_DIR@"
GAMBC_BIN_DIR="$INSTALL_DIR/current/bin"
GAMBC_LIB_DIR="$INSTALL_DIR/current/lib"
GAMBC_INCLUDE_DIR="$INSTALL_DIR/current/include"
FIRST_EXISTING_INCORRECT=""
i=0
check_clobber() # dir, gambc_dir, files
{
DIR="$1"
GAMBC_DIR="$2"
FILES="$3"
EXISTING_CORRECT=""
EXISTING_INCORRECT=""
MISSING=""
if [ "$FIRST_EXISTING_INCORRECT" == "" ] ; then
for f in $FILES ; do
if [ -e "$DIR/$f" ] ; then
if [ -L "$DIR/$f" -a "`readlink \"$DIR/$f\"`" == "$GAMBC_DIR/$f" ] ; then
EXISTING_CORRECT="$EXISTING_CORRECT $f"
else
EXISTING_INCORRECT="$EXISTING_INCORRECT $f"
if [ "$FIRST_EXISTING_INCORRECT" == "" ] ; then
FIRST_EXISTING_INCORRECT="$i"
fi
fi
else
MISSING="$MISSING $f"
fi
i=`expr $i + 1`
done
if [ "$FIRST_EXISTING_INCORRECT" != "" ] ; then
for f in $EXISTING_INCORRECT ; do
echo "The installation process is being aborted because the file $DIR/$f exists and it was not created by the Gambit-C installer."
done
exit `expr $FIRST_EXISTING_INCORRECT + 16 + 96`
fi
echo "EXISTING_CORRECT = $EXISTING_CORRECT"
echo "EXISTING_INCORRECT = $EXISTING_INCORRECT"
echo "MISSING = $MISSING"
fi
}
check_clobber "$BIN_DIR" "$GAMBC_BIN_DIR" "$PROGRAMS"
check_clobber "$LIB_DIR" "$GAMBC_LIB_DIR" "$LIBRARIES"
check_clobber "$INCLUDE_DIR" "$GAMBC_INCLUDE_DIR" "$INCLUDES"
exit 0