| 1 | #!/bin/shscip-shell filesystem . . `/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 [scip-shell system . . `[`. -z "$INSTALL_NONROOT" ] |
| 22 | then |
| 23 | idscip-shell system . . id. | grepscip-shell system . . grep. "^uid=0(" > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 24 | if [scip-shell system . . `[`. $? -ne 0 ] |
| 25 | then |
| 26 | echoscip-shell system . . echo. "We don't recommend installing as non-root. To try anyway," |
| 27 | echoscip-shell system . . echo. "export INSTALL_NONROOT=1 before running the install." |
| 28 | echoscip-shell system . . echo. "NOTE: You should also export PREFIX=/your/home/dir/fte to" |
| 29 | echoscip-shell system . . echo. "give this a chance of working." |
| 30 | exit 1 |
| 31 | fi |
| 32 | else |
| 33 | echoscip-shell system . . echo. "Root-check bypassed - installing at your own risk" |
| 34 | fi |
| 35 | |
| 36 | # Ensure everything is made. |
| 37 | makescip-shell system . . make. -e all |
| 38 | if [scip-shell system . . `[`. $? -ne 0 ] |
| 39 | then |
| 40 | echoscip-shell system . . 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 | rmscip-shell system . . rm. -rf $CONFIGDIR |
| 46 | |
| 47 | # Make the directories we'll need. |
| 48 | mkdirscip-shell system . . mkdir. -p $BINDIR |
| 49 | mkdirscip-shell system . . mkdir. -p $LIBDIR |
| 50 | mkdirscip-shell system . . 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 [scip-shell system . . `[`. -f $dir/$file ] |
| 60 | then |
| 61 | # try to copy it. |
| 62 | cpscip-shell system . . cp. $dir/$file $BINDIR 2> /dev/nullscip-shell filesystem . . `/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 [scip-shell system . . `[`. $? -ne 0 ] |
| 68 | then |
| 69 | # Unix has the nice capability of being able to unlink |
| 70 | # in-use files. |
| 71 | echoscip-shell system . . echo. "Forcing $file" |
| 72 | rmscip-shell system . . rm. -f $BINDIR/$file |
| 73 | cpscip-shell system . . cp. $dir/$file $BINDIR |
| 74 | fi |
| 75 | fi |
| 76 | done |
| 77 | done |
| 78 | |
| 79 | # Copy our configuration. |
| 80 | cpscip-shell system . . cp. -r config $LIBDIR |
| 81 | # Somehow things may not all be properly readable by everyone. |
| 82 | chmodscip-shell system . . chmod. a+r $CONFIGDIR/* |
| 83 | chmodscip-shell system . . chmod. a+r $CONFIGDIR/*/* |
| 84 | |
| 85 | # Any CVS directory that is copied over should be uncopied over. |
| 86 | rmscip-shell system . . rm. -rf `findscip-shell system . . find. $CONFIGDIR -type d -name CVS` |
| 87 | |
| 88 | # Set the directories to be world-executable. |
| 89 | chmodscip-shell system . . chmod. a+x `findscip-shell system . . 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 [scip-shell system . . `[`. ! -f $LOCALCONFIGDIR/systemmain.fte ] |
| 94 | then |
| 95 | mvscip-shell system . . 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 |