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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
#!/bin/sh
echo "Welcome to the Linux bzflag installation program."
echo "No files will be installed until after a final warning."
echo
#
# Check for root
#
if [ $EUID != 0 ]; then
echo "You must run the bzflag install program as root."
exit 1
fi
#
# Pick a destination
#
dest=/usr/local/bzflag
echo -n "Where would you like bzflag installed? [$dest] "
read ans
if [ x$ans != "x" ]; then
dest=$ans
fi
#
# See if Mesa is installed
#
echo
echo "bzflag uses the Mesa libraries. Versions of Mesa prior to"
echo "2.6 Beta 3 will not work correctly with bzflag."
installMesa=y
ans=x
while [ $ans != y -a $ans != n ]; do
echo -n "Do you want to install the Mesa libraries packaged with bzflag? [y] "
read ans
ans=`echo ${ans}y | sed -e 'y/YN/yn/' -e 's/^\(.\).*/\1/'`
done
if [ $ans = n ]; then
installMesa=n
fi
#
# Where should Mesa go?
#
mesaDest=$dest/lib
if [ $installMesa = y ]; then
echo
echo "Where would you like to install Mesa? The directory"
echo -n "will be created if it doesn't exist. [$mesaDest] "
read ans
if [ x$ans != "x" ]; then
mesaDest=$ans
fi
fi
#
# Check for 3Dfx board
#
use3Dfx=n
if [ -f /usr/local/glide/lib/libglide2x.so ]; then
echo
echo "You appear to have the 3Dfx libraries installed."
ans=x
while [ $ans != y -a $ans != n ]; do
echo -n "Should bzflag try to use an installed 3Dfx board? [y] "
read ans
ans=`echo ${ans}y | sed -e 'y/YN/yn/' -e 's/^\(.\).*/\1/'`
done
if [ $ans = y ]; then
use3Dfx=y
fi
fi
#
# warn about requiring root access for 3Dfx board
#
nonRoot3Dfx=n
if [ $use3Dfx = y ]; then
echo
echo "Using the 3Dfx board requires that bzflag be run as superuser"
echo "(so the glide libraries can access the hardware). Since"
echo "LD_LIBRARY_PATH is ignored for setuid programs, you must"
echo "either run bzflag as superuser or add the paths to the"
echo "Mesa and glide libraries to your ld.so.conf file. This"
echo "installer can add those entries and make bzflag setuid root"
echo "so that regular users can run bzflag using the 3Dfx card."
ans=x
while [ $ans != y -a $ans != n ]; do
echo -n "Make bzflag with 3Dfx available to all users? [y] "
read ans
ans=`echo ${ans}y | sed -e 'y/YN/yn/' -e 's/^\(.\).*/\1/'`
done
if [ $ans = y ]; then
nonRoot3Dfx=y
fi
fi
#
# about to install
#
echo
echo -n "About to begin installation. Press enter to proceed."
read ans
#
# make directories
#
if [ ! -d $dest ]; then
mkdir -p $dest
if [ ! -d $dest ]; then
echo "Failed to make bzflag directory $dest"
exit 1
fi
fi
if [ ! -d $dest/bin ]; then
mkdir $dest/bin
if [ ! -d $dest/bin ]; then
echo "Failed to make bzflag bin directory $dest/bin"
exit 1
fi
fi
if [ ! -d $dest/data ]; then
mkdir $dest/data
if [ ! -d $dest/data ]; then
echo "Failed to make bzflag data directory $dest/data"
exit 1
fi
fi
if [ $installMesa = y -a ! -d $mesaDest ]; then
mkdir -p $mesaDest
if [ ! -d $mesaDest ]; then
echo "Failed to make Mesa directory $mesaDest"
exit 1
fi
fi
#
# Install the binaries
#
cp bin/* $dest/bin
#
# Install the data
#
cp data/* $dest/data
#
# Install Mesa libs
#
if [ $installMesa = y ]; then
if [ $use3Dfx = y ]; then
cp lib/lib3DfxMesaGL.so.2 $mesaDest/libMesaGL.so.2
else
cp lib/libMesaGL.so.2 $mesaDest/libMesaGL.so.2
fi
cp lib/libMesaGLU.so.2 $mesaDest
fi
#
# Add Glide and Mesa to system library path. Just setting LD_LIBRARY_PATH
# in the wrapper script won't work because that variable isn't used for
# setuid executables.
#
ldConfig=n
if [ $installMesa = y ]; then
egrep "^$dest/lib$" /etc/ld.so.conf >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo $dest/lib >> /etc/ld.so.conf
ldConfig=y
fi
fi
if [ $nonRoot3Dfx = y ]; then
egrep "^/usr/local/glide/lib$" /etc/ld.so.conf >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo /usr/local/glide/lib >> /etc/ld.so.conf
ldConfig=y
fi
fi
if [ $ldConfig = y ]; then
/sbin/ldconfig
fi
#
# Make the wrapper scripts
#
if [ $use3Dfx = y ]; then
cat <<_EOS_ > $dest/bin/bzflag
#!/bin/sh -f
export LD_LIBRARY_PATH=${mesaDest}:/usr/local/glide/lib
export MESA_GLX_FX=fullscreen
$dest/bin/bzflag.real -directory $dest/data \$*
_EOS_
if [ $nonRoot3Dfx = y ]; then
chown root $dest/bin/bzflag.real
chmod u+s $dest/bin/bzflag.real
fi
else
cat <<_EOS_ > $dest/bin/bzflag
#!/bin/sh -f
export LD_LIBRARY_PATH=${mesaDest}
$dest/bin/bzflag.real -directory $dest/data \$*
_EOS_
fi
chmod +x $dest/bin/bzflag
echo "Installation complete"
|