home *** CD-ROM | disk | FTP | other *** search
/ O2 Marketing & Sales Demos / o2_marketing_demos_96.iso / Configure_Demos next >
Encoding:
Text File  |  1996-09-28  |  6.0 KB  |  141 lines

  1. #!/bin/sh
  2. #**************************************************************************
  3. #*                                                                        *
  4. #*            Copyright (c) 1996 Silicon Graphics, Inc.                   *
  5. #*                      All Rights Reserved                               *
  6. #*                                                                        *
  7. #*         THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI             *
  8. #*                                                                        *
  9. #* The copyright notice above does not evidence any actual of intended    *
  10. #* publication of such source code, and is an unpublished work by Silicon *
  11. #* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
  12. #* the property of Silicon Graphics, Inc. Any use, duplication or         *
  13. #* disclosure not specifically authorized by Silicon Graphics is strictly *
  14. #* prohibited.                                                            *
  15. #*                                                                        *
  16. #* RESTRICTED RIGHTS LEGEND:                                              *
  17. #*                                                                        *
  18. #* Use, duplication or disclosure by the Government is subject to         *
  19. #* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in   *
  20. #* Technical Data and Computer Software clause at DFARS 52.227-7013,      *
  21. #* and/or in similar or successor clauses in the FAR, DOD or NASA FAR     *
  22. #* Supplement. Unpublished - rights reserved under the Copyright Laws of  *
  23. #* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.       *
  24. #* Shoreline Blvd., Mountain View, CA 94039-7311                          *
  25. #**************************************************************************
  26.  
  27. #
  28. # This script should provide a quick easy way to configure demos to run
  29. # from either the CDROM or install the demo to the hard drive from where
  30. # it can be run.
  31. #
  32.  
  33. # This should work in a second CDROM drive also.
  34. #
  35. if [ -f /CDROM2/Configure_Demos ]
  36.    then
  37.       CDDIR=CDROM2
  38.    else
  39.       CDDIR=CDROM
  40. fi
  41.  
  42. FROMDIR="/$CDDIR/O2_Demos"
  43. TODIR="/usr/demos/General_Demos"
  44.  
  45. cd $FROMDIR
  46.  
  47. ROOTPW=`fgrep root /etc/passwd | cut -d: -f2`
  48.  
  49. #
  50. # If no root password or user is root then go ahead and try to install links 
  51. #
  52. if [ -z "$ROOTPW" -o `whoami` = "root" ]
  53.    then
  54.  
  55.       # Remove any links in TODIR so they will not interfere with the user copying in demos 
  56.       # and ask user if any demos are installed if they want to keep them
  57.       for i in * 
  58.          do
  59.             if [ -l "$TODIR/$i" ]
  60.                then
  61.                   /sbin/su - root -c "rm $TODIR/$i"
  62.                elif [ -d "$TODIR/$i" ]
  63.                   then
  64.                      case `xconfirm -c -icon question -b Remove -B Keep \
  65.                            -t "Demo \"$i\" appears to be installed on the hard drive." \
  66.                            -t "Do you wish to remove demo \"$i\" from the hard disk and have it" \
  67.                            -t "run from CDROM instead?"`
  68.                         in
  69.                            Remove) /sbin/su - root -c "rm -rf $TODIR/$i";;
  70.                            Keep) ;;
  71.                      esac
  72.             fi
  73.       done
  74.  
  75.       if [ "Install" = `xconfirm -c -icon question -b "CD_Only" -B "Install" \
  76.       -t "Do you wish to run all of the demos from CDROM or install some demos to the hard drive?" \
  77.       -t "" \
  78.       -t "All demos will run from CDROM, although a few take more than a minute to read data during start up." \
  79.       -t "It is highly recommended that you install at least those few demos to your hard drive."` ]
  80.          then
  81.  
  82.            ( sleep 4; xconfirm -c -icon info -B "Done" \
  83.             -t "- It is highly recommended that \"perftoon\", \"egghead\" and \"Visfly\"" \
  84.                 -t "  are installed on the hard drive." \
  85.             -t "" \
  86.             -t "- To install individual O2_demos on the hard drive." \
  87.             -t "     Drag the corresponding demo folder from the CDROM directory view" \
  88.             -t "     to the General_Demos directory view." \
  89.             -t "" \
  90.             -t "     $FROMDIR/demoFolder ---> $TODIR" \
  91.             -t "" \
  92.             -t "     Press \"Copy\" when prompted." \
  93.             -t "" \
  94.             -t "- Demo directories that are not installed on the hard drive will be" \
  95.                 -t "  automatically linked and run from CDROM." \
  96.             -t "" \
  97.             -t "- You must close both directory view windows when you are done installing demos." \
  98.             -t "" \
  99.             -t "- Demo configuration can be changed by launching \"Configure_Demos\" again." 1>/dev/null 2>&1 ) &
  100.  
  101.             # Open both DVWs as root so that permissions are ok
  102.             /sbin/su root -c "dirview $FROMDIR&; dirview $TODIR"
  103.  
  104.       fi
  105.  
  106.       # When the user is done copying the dirs and has closed the DVWs do or has chosen not to install any demos
  107.       for i in *
  108.          do
  109.             if [ -d $TODIR/$i ]     # if the user copied demo then correct permissions
  110.                then
  111.                   /sbin/su - root -c "chown -R nobody.nobody $TODIR/$i"
  112.                else                 # if the user didn't copy demo then link it
  113.                   /sbin/su - root -c "ln -s $FROMDIR/$i $TODIR/$i; chown -h nobody.nobody $TODIR/$i"
  114.             fi
  115.       done
  116.    else          # We don't have permissions to become root and add anything to TODIR
  117.       xconfirm -c -B Exit -icon error -t "$0 can not run because you have a root password." \
  118.       -t "Please either remove the root password or become root and run $0." 1>/dev/null
  119.       exit 1
  120. fi
  121.  
  122. . ./.performer_test
  123.  
  124. cd /usr/demos/Demo_Interfaces/Web/cgi-scripts/
  125. ./update_tables
  126.  
  127. NETSCAPES=`/sbin/ps -ef | /usr/bin/fgrep netscape | /usr/bin/fgrep -v fgrep`
  128.  
  129. if [ -n "$NETSCAPES" ]
  130.    then
  131.       /usr/bin/X11/netscape -remote openURL\(http://localhost/Demos\)
  132.    else
  133.       /usr/bin/X11/netscape http://localhost/Demos &
  134.       (
  135.         /usr/bin/X11/xconfirm -c -B "" -t "Starting Netscape" -icon progress  > /dev/null &
  136.         pid=$!
  137.         sleep 12
  138.         kill $pid 2>/dev/null
  139.       ) &
  140. fi
  141.