File: install

package info (click to toggle)
fte 0.50.2b6-20110708-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 3,768 kB
  • ctags: 6,761
  • sloc: cpp: 47,985; ansic: 2,795; sh: 112; makefile: 71; perl: 29
file content (102 lines) | stat: -rwxr-xr-x 2,704 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

# Installing FTE has gotten too complicated for a makefile.  Thus, a shell
# script.

# SETTINGS:

# Everything goes into this directory.  If it's not set, we'll use a default.
PREFIX=${PREFIX:-/usr/local}


# INSTALLATION CODE (do not touch):

BINDIR=$PREFIX/bin
LIBDIR=$PREFIX/lib/fte
CONFIGDIR=$LIBDIR/config

LOCALCONFIGDIR=$LIBDIR/localconfig

# To do some of this stuff, you should be root...
if [ -z "$INSTALL_NONROOT" ]
then
    id | grep "^uid=0(" > /dev/null
    if [ $? -ne 0 ]
    then
        echo "We don't recommend installing as non-root.  To try anyway,"
        echo "export INSTALL_NONROOT=1 before running the install."
        echo "NOTE: You should also export PREFIX=/your/home/dir/fte to"
        echo "give this a chance of working."
        exit 1
    fi
else
	echo "Root-check bypassed - installing at your own risk"
fi

# Ensure everything is made.
make -e all
if [ $? -ne 0 ]
then
	echo "Not everything could be made - not going to install it."
    exit 1
fi

# If there is a config directory, remove it.
rm -rf $CONFIGDIR

# Make the directories we'll need.
mkdir -p $BINDIR
mkdir -p $LIBDIR
mkdir -p $LOCALCONFIGDIR

# Set up our binaries.
for file in fte xfte cfte sfte vfte nfte
do
    # each binary is either in . or in src (if it exists at all on this platform)
    for dir in . src
    do
        # if this is the right directory for this file, use it.
        if [ -f $dir/$file ]
        then
            # try to copy it.
            cp $dir/$file $BINDIR 2> /dev/null
            # if that doesn't work, force it.
            # NOTE: This may crash any running copy of FTE on some platforms
            #       AIX, Linux: confirmed okay
            #       Sun: confirmed crash
            if [ $? -ne 0 ]
            then
                # Unix has the nice capability of being able to unlink
                # in-use files.
                echo "Forcing $file"
                rm -f $BINDIR/$file
                cp $dir/$file $BINDIR
            fi
        fi
    done
done

# Copy our configuration.
cp -r config $LIBDIR
# Somehow things may not all be properly readable by everyone.
chmod a+r $CONFIGDIR/*
chmod a+r $CONFIGDIR/*/*

# Any CVS directory that is copied over should be uncopied over.
rm -rf `find $CONFIGDIR -type d -name CVS`

# Set the directories to be world-executable.
chmod a+x `find $CONFIGDIR -type d`

# If the sysadmin does not have a system-wide config, set it up.
# If it already exists DO NOT OVERWRITE IT.
if [ ! -f $LOCALCONFIGDIR/systemmain.fte ]
then
    mv $CONFIGDIR/systemmain.fte $LOCALCONFIGDIR
fi

# Set up the system default rc file.
(cd $CONFIGDIR; $BINDIR/cfte main.fte $LIBDIR/system.fterc)

# Done.
exit 0