home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / wizards / 5213 / rvi_install < prev    next >
Encoding:
Text File  |  1992-12-14  |  3.7 KB  |  105 lines

  1. :
  2. # rvi_install: installation script for 'rvi' (must be run as 'root').
  3. #
  4. # READ THE FOLLOWING CAREFULLY:
  5. # This script is invoked as "sh rvi_install <rvi-parent-directory>" where
  6. # "<rvi-parent-directory>" is an existing directory underneath which you
  7. # want the "rvi-directory" to reside.  If you want the "rvi-directory" to
  8. # be called something other than "rvitmp", change the definition of
  9. # "rvidir" below.  To install the "rvi-directory" as a sub-directory
  10. # of your current directory, use "sh rvi_install ."; to install it as
  11. # a sub-directory of some other directory, use "sh rvi_install <otherdir>"
  12. # where "<otherdir>" is the name of that other directory.  Note that
  13. # for a user to run 'rvi', there must be an "rvi-directory" on the device
  14. # or partition where the user's current directory is located, and if
  15. # this "rvi-directory" isn't the one named in /etc/default/rvi, then
  16. # the user's environment variable $RVIDIR must be set to the name of
  17. # the "rvi-directory" on the user's local device or partition.
  18. #
  19. # Additional programs that you want to make accessible from within 'rvi'
  20. # should be linked or copied into either the rvi-directory, or the
  21. # 'bin' subdirectory of the rvi-directory.  You must not have removed
  22. # the distributed files 'rvi' or 'sh' in the "rvi-directory" if you want
  23. # users to be able to reach external programs.
  24. #
  25.  
  26. if [ $# -ne 1 ]; then
  27.     echo "$0: usage: $0 <rvi-parent-directory>" 1>&2
  28.     exit 1
  29. fi
  30. RVIPRT=$1
  31. rvidir="$RVIPRT/rvitmp"
  32.  
  33. if [ ! -f "rvi.c" ]; then
  34.     echo "$0: can't find file 'rvi.c'" 1>&2
  35.     echo "$0: aborting..." 1>&2
  36.     exit 1
  37. else
  38.     echo "$0: compiling 'rvi.c'....."
  39.     if cc -o rvi rvi.c; then
  40.         chown root rvi; chmod u+s rvi; chmod a+x rvi;
  41.         if [ $? -ne 0 ]; then
  42.             echo "$0: can't resecure 'rvi'; aborting..." 1>&2
  43.             exit 1
  44.         fi
  45.     else
  46.         echo "$0: got a problem compiling 'rvi.c'" 1>&2
  47.         exit 1
  48.     fi
  49. fi
  50. if [ -f "rvish.c" ]; then
  51.     echo "$0: compiling 'rvish.c'; this will eventually become"
  52.     echo "       the program 'sh' in the 'rvi-directory'....."
  53.     cc -o rvish rvish.c
  54.     chown bin rvish; chmod 0755 rvish;
  55. fi
  56. echo "Now creating working directories, linking files, and so forth:"
  57. echo "     $rvidir....."
  58. mkdir $rvidir; chown bin $rvidir; chmod 0755 $rvidir
  59. echo "     $rvidir/tmp....."
  60. mkdir $rvidir/tmp; chown bin $rvidir/tmp; chmod 0777 $rvidir/tmp
  61. echo "     $rvidir/etc....."
  62. mkdir $rvidir/etc; chown bin $rvidir/etc; chmod 0755 $rvidir/etc
  63. echo "     $rvidir/bin....."
  64. mkdir $rvidir/bin; chown bin $rvidir/bin; chmod 0755 $rvidir/bin
  65. echo "     $rvidir/usr....."
  66. mkdir $rvidir/usr; chown bin $rvidir/usr; chmod 0755 $rvidir/usr
  67. echo "     $rvidir/usr/lib....."
  68. mkdir $rvidir/usr/lib; chown bin $rvidir/usr/lib; chmod 0755 $rvidir/usr/lib
  69. if [ $? -ne 0 ]; then echo "$0: aborting"; exit 1; fi
  70. echo "$0: linking stuff:"
  71. echo "     /etc/termcap....."
  72. ln /etc/termcap $rvidir/etc/termcap; if [ $? -ne 0 ]
  73.     then
  74.         echo "$0: can't 'ln', doing 'cp' instead..."
  75.         cp /etc/termcap $rvidir/etc/termcap;
  76.     fi
  77. echo "     /usr/lib/ex3.7strings....."
  78. ln /usr/lib/ex3.7strings $rvidir/usr/lib/ex3.7strings; if [ $? -ne 0 ]
  79.     then
  80.         echo "$0: can't 'ln', doing 'cp' instead..."
  81.         cp /usr/lib/ex3.7strings $rvidir/usr/lib/ex3.7strings
  82.     fi
  83. echo "     /bin/vi....."
  84. ln /bin/vi $rvidir/vi; if [ $? -ne 0 ]
  85.     then
  86.         echo "$0: can't 'ln', doing 'cp' instead..."
  87.         cp /bin/vi $rvidir/vi
  88.     fi
  89. echo "     /bin/sh (don't worry, it's the restricted one)"
  90. ln /bin/sh $rvidir/rsh; if [ $? -ne 0 ]
  91.     then
  92.         echo "$0: can't 'ln', doing 'cp' instead..."
  93.         cp /bin/sh $rvidir/rsh
  94.     fi
  95. ln $rvidir/rsh $rvidir/bin/rsh
  96. ln ./rvish $rvidir/sh; if [ $? -ne 0 ]
  97.     then
  98.         echo "$0: can't 'ln', doing 'cp' instead..."
  99.     cp ./rvish $rvidir/sh
  100.     fi
  101. ln $rvidir/sh $rvidir/bin/sh
  102. echo "$0: writing /etc/default/rvi....."
  103. cd $rvidir; echo `pwd` >/etc/default/rvi; chmod 0644 /etc/default/rvi
  104. echo "$0: done"
  105.