Debian Codegraph @

install

raw symbols SCIP
1 #!/bin/sh
2
3 # Installing FTE has gotten too complicated for a makefile. Thus, a shell
4 # script.
5
6 # SETTINGS:
7
8 # Everything goes into this directory. If it's not set, we'll use a default.
9 PREFIX=${PREFIX:-/usr/local}
10
11
12 # INSTALLATION CODE (do not touch):
13
14 BINDIR=$PREFIX/bin
15 LIBDIR=$PREFIX/lib/fte
16 CONFIGDIR=$LIBDIR/config
17
18 LOCALCONFIGDIR=$LIBDIR/localconfig
19
20 # To do some of this stuff, you should be root...
21 if [ -z "$INSTALL_NONROOT" ]
22 then
23 id | grep "^uid=0(" > /dev/null
24 if [ $? -ne 0 ]
25 then
26 echo "We don't recommend installing as non-root. To try anyway,"
27 echo "export INSTALL_NONROOT=1 before running the install."
28 echo "NOTE: You should also export PREFIX=/your/home/dir/fte to"
29 echo "give this a chance of working."
30 exit 1
31 fi
32 else
33 echo "Root-check bypassed - installing at your own risk"
34 fi
35
36 # Ensure everything is made.
37 make -e all
38 if [ $? -ne 0 ]
39 then
40 echo "Not everything could be made - not going to install it."
41 exit 1
42 fi
43
44 # If there is a config directory, remove it.
45 rm -rf $CONFIGDIR
46
47 # Make the directories we'll need.
48 mkdir -p $BINDIR
49 mkdir -p $LIBDIR
50 mkdir -p $LOCALCONFIGDIR
51
52 # Set up our binaries.
53 for file in fte xfte cfte sfte vfte nfte
54 do
55 # each binary is either in . or in src (if it exists at all on this platform)
56 for dir in . src
57 do
58 # if this is the right directory for this file, use it.
59 if [ -f $dir/$file ]
60 then
61 # try to copy it.
62 cp $dir/$file $BINDIR 2> /dev/null
63 # if that doesn't work, force it.
64 # NOTE: This may crash any running copy of FTE on some platforms
65 # AIX, Linux: confirmed okay
66 # Sun: confirmed crash
67 if [ $? -ne 0 ]
68 then
69 # Unix has the nice capability of being able to unlink
70 # in-use files.
71 echo "Forcing $file"
72 rm -f $BINDIR/$file
73 cp $dir/$file $BINDIR
74 fi
75 fi
76 done
77 done
78
79 # Copy our configuration.
80 cp -r config $LIBDIR
81 # Somehow things may not all be properly readable by everyone.
82 chmod a+r $CONFIGDIR/*
83 chmod a+r $CONFIGDIR/*/*
84
85 # Any CVS directory that is copied over should be uncopied over.
86 rm -rf `find $CONFIGDIR -type d -name CVS`
87
88 # Set the directories to be world-executable.
89 chmod a+x `find $CONFIGDIR -type d`
90
91 # If the sysadmin does not have a system-wide config, set it up.
92 # If it already exists DO NOT OVERWRITE IT.
93 if [ ! -f $LOCALCONFIGDIR/systemmain.fte ]
94 then
95 mv $CONFIGDIR/systemmain.fte $LOCALCONFIGDIR
96 fi
97
98 # Set up the system default rc file.
99 (cd $CONFIGDIR; $BINDIR/cfte main.fte $LIBDIR/system.fterc)
100
101 # Done.
102 exit 0