home *** CD-ROM | disk | FTP | other *** search
/ CD Action 35 / cdactionmagazinecoverdisc351999.iso / BFRIS / setup < prev    next >
Text File  |  1999-02-03  |  4KB  |  148 lines

  1. #!/bin/sh
  2.  
  3. echo "Welcome to the Linux BFRIS demo installation program."
  4. echo "No files will be installed until after a final warning."
  5. echo
  6. echo "Please read the following license agreement.  If you do"
  7. echo "agree to this license, you may press Control-C at any time"
  8. echo "to abort this installation."
  9. echo
  10. echo -n "Press enter to see the license agreement:"
  11.  
  12. read ans
  13.  
  14. more license.txt
  15. echo
  16. ans=x
  17.  
  18. while [ $ans != y -a $ans != n ]; do
  19.  echo -n "Do you agree to the terms of this license agreement? [n] "
  20.  read ans
  21.  ans=`echo ${ans}n | sed -e 'y/YN/yn/' -e 's/^\(.\).*/\1/'`
  22. done
  23.  
  24. if [ $ans != y ]; then
  25.   echo "Installation aborted"
  26.   exit 1
  27. fi
  28.  
  29.  
  30. if [ $EUID != 0 ]; then
  31.     echo "You must run the BFRIS install program as root."
  32.     exit 1
  33. fi
  34.  
  35. dest=/usr/local/games/bfrisdemo
  36. echo -n "Where would you like the BFRIS demo installed? [$dest] "
  37. read ans
  38. if [ x$ans != "x" ]; then
  39.     dest=$ans
  40. fi
  41.  
  42. instvar=y
  43. echo
  44. echo "The BFRIS launcher can be installed in /usr/local/bin.  To use it,"
  45. echo "you must set the BFRISDIR environment variable to point to "
  46. echo -n $dest
  47. echo ", where you will install BFRIS.  We can set this for you"
  48. echo "in your .cshrc and .profile files; would you like to install the BFRIS"
  49. echo -n "launcher and set this variable automatically upon login? [y] "
  50. read ans
  51. ans=`echo ${ans}y | sed -e 'y/YN/yn/' -e 's/^\(.\).*/\1/'`
  52. if [ $ans = n ]; then
  53.     installvar=n
  54. fi
  55. echo
  56.  
  57. intro=n
  58.  
  59. echo
  60. echo "BFRIS requires hardware-accelerated OpenGL.  BFRIS ships with Mesa 3.0"
  61. echo "compiled with support for 3Dfx Voodoo Graphics, Voodoo Rush, and Voodoo2"
  62. echo "chipsets."
  63. echo
  64. installMesa=y
  65. ans=x
  66. while [ $ans != y -a $ans != n ]; do
  67.     echo -n "Do you want to install Mesa 3.0 libraries packaged with BFRIS? [y] "
  68.     read ans
  69.     ans=`echo ${ans}y | sed -e 'y/YN/yn/' -e 's/^\(.\).*/\1/'`
  70. done
  71. if [ $ans = n ]; then
  72.     installMesa=n
  73. fi
  74.  
  75. mesaDest=$dest/lib
  76.  
  77. echo
  78. echo -n "About to begin installation.  Press enter to proceed, or control-C to abort."
  79. read ans
  80.  
  81. echo "(You may see warnings about three directories that are not copied, and if you"
  82. echo "elected to install the Mesa libraries, you may see a warning about ldconfig;"
  83. echo "these messages can usually be safely ignored.)"
  84. echo
  85.  
  86. if [ ! -d $dest ]; then
  87.     mkdir -p $dest
  88.     if [ ! -d $dest ]; then
  89.         echo "Failed to make bfris directory $dest"
  90.         exit 1
  91.     fi
  92. fi
  93. if [ $installMesa = y -a ! -d $mesaDest ]; then
  94.     mkdir -p $mesaDest
  95.     if [ ! -d $mesaDest ]; then
  96.         echo "Failed to make Mesa directory $mesaDest"
  97.         exit 1
  98.     fi
  99. fi
  100.  
  101.  
  102. cp -f disk1/* $dest
  103.  
  104. if [ $intro = y ]; then
  105.   cp disk1/intro/intro.mvy $dest
  106. fi
  107.  
  108. if [ $installMesa = y ]; then
  109.   cp disk1/mesa3dfx/libMesaGL.so.3.0 $mesaDest
  110.   cp disk1/mesa3dfx/libMesaGLU.so.3.0 $mesaDest
  111.   chmod a+rx $mesaDest/*
  112. fi
  113.  
  114. if [ $instvar = y ]; then
  115.   cp disk1/bfris /usr/local/bin
  116.   chmod a+rx /usr/local/bin/bfris
  117.   chmod a+rx $dest/bfrisc
  118.   chmod a+rx $dest/lnx_sdrv
  119.   chmod a+rx $dest/bfrisd
  120.   egrep "^$dest/lib$" $HOME/.profile >/dev/null 2>&1
  121.   if [ $? -ne 0 ]; then
  122.     echo "export BFRISDIR="$dest >> $HOME/.profile
  123.   fi
  124.   egrep "^$dest/lib$" $HOME/.cshrc >/dev/null 2>&1
  125.   if [ $? -ne 0 ]; then
  126.     echo "setenv BFRISDIR "$dest >> $HOME/.cshrc
  127.   fi
  128. fi
  129.  
  130. ldConfig=n
  131. if [ $installMesa = y ]; then
  132.     egrep "^$dest/lib$" /etc/ld.so.conf >/dev/null 2>&1
  133.     if [ $? -ne 0 ]; then
  134.         echo $dest/lib >> /etc/ld.so.conf
  135.         ldConfig=y
  136.     fi
  137. fi
  138. if [ $ldConfig = y ]; then
  139.     /sbin/ldconfig
  140. fi
  141.  
  142. echo
  143. echo
  144. echo "Installation complete.  Make sure you are logged in as root,"
  145. echo "then change to $dest and type ./bfris to play." 
  146. echo
  147.  
  148.