home *** CD-ROM | disk | FTP | other *** search
- :
- # rvi_install: installation script for 'rvi' (must be run as 'root').
- #
- # READ THE FOLLOWING CAREFULLY:
- # This script is invoked as "sh rvi_install <rvi-parent-directory>" where
- # "<rvi-parent-directory>" is an existing directory underneath which you
- # want the "rvi-directory" to reside. If you want the "rvi-directory" to
- # be called something other than "rvitmp", change the definition of
- # "rvidir" below. To install the "rvi-directory" as a sub-directory
- # of your current directory, use "sh rvi_install ."; to install it as
- # a sub-directory of some other directory, use "sh rvi_install <otherdir>"
- # where "<otherdir>" is the name of that other directory. Note that
- # for a user to run 'rvi', there must be an "rvi-directory" on the device
- # or partition where the user's current directory is located, and if
- # this "rvi-directory" isn't the one named in /etc/default/rvi, then
- # the user's environment variable $RVIDIR must be set to the name of
- # the "rvi-directory" on the user's local device or partition.
- #
- # Additional programs that you want to make accessible from within 'rvi'
- # should be linked or copied into either the rvi-directory, or the
- # 'bin' subdirectory of the rvi-directory. You must not have removed
- # the distributed files 'rvi' or 'sh' in the "rvi-directory" if you want
- # users to be able to reach external programs.
- #
-
- if [ $# -ne 1 ]; then
- echo "$0: usage: $0 <rvi-parent-directory>" 1>&2
- exit 1
- fi
- RVIPRT=$1
- rvidir="$RVIPRT/rvitmp"
-
- if [ ! -f "rvi.c" ]; then
- echo "$0: can't find file 'rvi.c'" 1>&2
- echo "$0: aborting..." 1>&2
- exit 1
- else
- echo "$0: compiling 'rvi.c'....."
- if cc -o rvi rvi.c; then
- chown root rvi; chmod u+s rvi; chmod a+x rvi;
- if [ $? -ne 0 ]; then
- echo "$0: can't resecure 'rvi'; aborting..." 1>&2
- exit 1
- fi
- else
- echo "$0: got a problem compiling 'rvi.c'" 1>&2
- exit 1
- fi
- fi
- if [ -f "rvish.c" ]; then
- echo "$0: compiling 'rvish.c'; this will eventually become"
- echo " the program 'sh' in the 'rvi-directory'....."
- cc -o rvish rvish.c
- chown bin rvish; chmod 0755 rvish;
- fi
- echo "Now creating working directories, linking files, and so forth:"
- echo " $rvidir....."
- mkdir $rvidir; chown bin $rvidir; chmod 0755 $rvidir
- echo " $rvidir/tmp....."
- mkdir $rvidir/tmp; chown bin $rvidir/tmp; chmod 0777 $rvidir/tmp
- echo " $rvidir/etc....."
- mkdir $rvidir/etc; chown bin $rvidir/etc; chmod 0755 $rvidir/etc
- echo " $rvidir/bin....."
- mkdir $rvidir/bin; chown bin $rvidir/bin; chmod 0755 $rvidir/bin
- echo " $rvidir/usr....."
- mkdir $rvidir/usr; chown bin $rvidir/usr; chmod 0755 $rvidir/usr
- echo " $rvidir/usr/lib....."
- mkdir $rvidir/usr/lib; chown bin $rvidir/usr/lib; chmod 0755 $rvidir/usr/lib
- if [ $? -ne 0 ]; then echo "$0: aborting"; exit 1; fi
- echo "$0: linking stuff:"
- echo " /etc/termcap....."
- ln /etc/termcap $rvidir/etc/termcap; if [ $? -ne 0 ]
- then
- echo "$0: can't 'ln', doing 'cp' instead..."
- cp /etc/termcap $rvidir/etc/termcap;
- fi
- echo " /usr/lib/ex3.7strings....."
- ln /usr/lib/ex3.7strings $rvidir/usr/lib/ex3.7strings; if [ $? -ne 0 ]
- then
- echo "$0: can't 'ln', doing 'cp' instead..."
- cp /usr/lib/ex3.7strings $rvidir/usr/lib/ex3.7strings
- fi
- echo " /bin/vi....."
- ln /bin/vi $rvidir/vi; if [ $? -ne 0 ]
- then
- echo "$0: can't 'ln', doing 'cp' instead..."
- cp /bin/vi $rvidir/vi
- fi
- echo " /bin/sh (don't worry, it's the restricted one)"
- ln /bin/sh $rvidir/rsh; if [ $? -ne 0 ]
- then
- echo "$0: can't 'ln', doing 'cp' instead..."
- cp /bin/sh $rvidir/rsh
- fi
- ln $rvidir/rsh $rvidir/bin/rsh
- ln ./rvish $rvidir/sh; if [ $? -ne 0 ]
- then
- echo "$0: can't 'ln', doing 'cp' instead..."
- cp ./rvish $rvidir/sh
- fi
- ln $rvidir/sh $rvidir/bin/sh
- echo "$0: writing /etc/default/rvi....."
- cd $rvidir; echo `pwd` >/etc/default/rvi; chmod 0644 /etc/default/rvi
- echo "$0: done"
-