home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 12 / Silicon_Graphics_Developer_Magic_Soft_Dev_812-8101-012.iso / .all / demos / ICS / RemoveIt2 < prev   
Encoding:
Text File  |  1995-11-01  |  2.7 KB  |  94 lines

  1. #!/bin/csh -f
  2.  
  3. set LOGFILE = `ls /tmp/* | grep BX351_DISTLOAD_LOG | wc -l`
  4.  
  5. if ($LOGFILE == 0) then
  6.    if ( -e /usr/lib/X11/builderXcessory) then
  7.     set INST_PATH = /usr/lib/X11/builderXcessory
  8.    else
  9.     set INST_PATH = "none"
  10.    endif
  11. else
  12.    set INST_PATH = `cat /tmp/BX351_DISTLOAD_LOG* | grep NEW_DIR_FROM_HM11 | /usr/bin/awk '{print $2}' | tail -1`
  13. endif
  14.  
  15. if ($INST_PATH == "") then
  16.     LOOP1:
  17.     echo " "
  18.     echo "Enter the full path name of the directory"
  19.     echo "where the demo is installed (or 'q' to quit):  \c"
  20.     set INST_PATH=($<)
  21.     if ( $#INST_PATH == 0 ) then
  22.         echo " "
  23.         echo "Input error.  Please try again."
  24.         goto LOOP1
  25.     else if ( $INST_PATH == 'q' ) then
  26.         echo " "
  27.         echo "... Bye."
  28.         sleep 3
  29.         exit
  30.     endif
  31. else
  32.     if ( -r $INST_PATH ) then
  33.  
  34.         if ( -w $INST_PATH ) then
  35.             echo " "
  36.             echo "About the remove the entire $INST_PATH directory."
  37.             echo "Is this OK (y/n)?  \c"
  38.             set ans=($<)
  39.             if ( $ans == 'y' ) then
  40.                 echo " "
  41.                 echo "Removing the default installation directory:"
  42.                 echo "        $INST_PATH"
  43.                 echo " "
  44.                 cd $INST_PATH
  45.                 ./removebxlinks
  46.             cd
  47.                 /bin/rm -rf $INST_PATH
  48.                 echo "Removal complete. "
  49.                 sleep 3
  50.                 exit
  51.             else 
  52.                 echo "... Bye."
  53.                 sleep 3
  54.                 exit
  55.             endif
  56.         else
  57.             echo " "
  58.             echo "You do not have permission to remove the $INST_PATH directory."
  59.             echo "If you are SURE you want to remove this, you will be asked"
  60.             echo "for the root password before proceeding."
  61.             echo " "
  62.             echo "Continue (y/n)?  \c"
  63.             set ans=($<)
  64.             if ( $ans == 'y' ) then
  65.                 echo " "
  66.                 echo "Removing $INST_PATH.  Please wait..."
  67.                 su - root -c "/bin/rm -rf $INST_PATH"
  68.                 echo " "
  69.                 echo "Removal complete."
  70.                 sleep 3
  71.                 echo "Press Enter to exit this window...  \c"
  72.                 set a = $<
  73.                 exit
  74.             else
  75.                 echo " "
  76.                 echo "... Bye."
  77.                 sleep 3
  78.                 echo "Press Enter to exit this window...  \c"
  79.                 set a = $<
  80.                 exit
  81.             endif
  82.         endif
  83.     else
  84.         echo " "
  85.         echo "Could not find the $INST_PATH directory.  Please try again."
  86.         echo " "
  87.         echo " "
  88.         echo "... Bye."
  89.         sleep 10
  90.     endif
  91.     echo "Press Enter to exit this window...  \c"
  92.     set a = $<
  93. endif
  94.