home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nics / root.2 / usr / lib / netcfg / bin / ndcleanup / ndcleanup~
Text File  |  1998-08-19  |  1KB  |  54 lines

  1. #!/sbin/sh
  2.  
  3. # Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  4. #                                                                         
  5. #        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  6. #                   SANTA CRUZ OPERATION INC.                             
  7. #                                                                         
  8. #   The copyright notice above does not evidence any actual or intended   
  9. #   publication of such source code.                                      
  10.  
  11. #ident "@(#)ndcleanup.sh    19.1
  12. #
  13. # cleanup netX remnants if netcfg went belly up before
  14. # removing the netX and MDI drivers ndcfg added to the system
  15. #
  16. # TODO: idinstall -d unconfigured netX drivers not in resmgr?
  17. #
  18.  
  19. removed=true
  20. netx=`netcfg -I dlpi`
  21.  
  22. cleanupnetX()
  23. {
  24.     removed=""
  25.  
  26.     for key in `resmgr | awk '$1 != "KEY" { print $1 }'`
  27.     do
  28.         r=`echo "resdump $key" | /usr/sbin/ndcfg | grep NETCFG_ELEMENT` && {
  29.             rn=`echo $r | awk '{ print $7 }'`
  30.             rogue=0
  31.             for n in $netx
  32.             do
  33.                 if [ "$n" = "$rn" ]
  34.                 then
  35.                     rogue=1
  36.                     break
  37.                 fi
  38.             done
  39.             if [ "$rogue" = "0" ]
  40.             then
  41.                 echo "idremove $rn 0" | /usr/sbin/ndcfg
  42.                 removed=true
  43.                 break
  44.             fi
  45.         }
  46.     done
  47. }
  48.  
  49. while [ "$removed" ]
  50. do
  51.     cleanupnetX
  52. done
  53. /etc/conf/bin/idconfupdate
  54.