home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / sgi / 12478 < prev    next >
Encoding:
Text File  |  1992-08-16  |  2.1 KB  |  79 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!ux1.cso.uiuc.edu!milo.mcs.anl.gov!ibm.mcs.anl.gov!nickless
  3. From: nickless@ibm.mcs.anl.gov (Bill Nickless)
  4. Subject: Re: Using the Automounter
  5. Message-ID: <7140083348377@ibm.mcs.anl.gov>
  6. Sender: usenet@mcs.anl.gov
  7. Nntp-Posting-Host: ibm.mcs.anl.gov
  8. Organization: Argonne National Laboratory, Chicago, Illinois
  9. References: <4275@inca.comlab.ox.ac.uk>
  10. Date: Sun, 16 Aug 1992 23:38:54 GMT
  11. Lines: 66
  12.  
  13. In article <4275@inca.comlab.ox.ac.uk> mjs@prg.ox.ac.uk (Michael Smith) writes:
  14. >Has anyone out there perfected use of this wonderful feature?
  15. >I have managed to set it up, but, for example, typing
  16. >cd /home/nmra and then pwd gives /tmp_mnt/home/nmra, which
  17. >is fine-ish, but makes things a bit more difficult to use.
  18. >Is there some way of setting it up so the look is the same
  19. >as with the ordinary mount?
  20.  
  21. Two ways: 
  22.  
  23. 1) Live with it--having the /tmp_mnt in the beginning of the path shouldn't 
  24. break too many things.
  25.  
  26. 2) Use the following perl script as a replacement for pwd for the 
  27. applications that thing they really need the absolute pathname.  Hope it 
  28. helps.
  29.  
  30. #!/usr/local/bin/perl
  31. eval "exec /usr/local/bin/perl -S $0 $*" if $running_under_some_shell;
  32.  
  33. $_ = `/bin/pwd`;
  34. chop;
  35.  
  36. @thisdir = stat ($_);
  37. @thatdir = ();
  38.  
  39. # Let's try and see if it's the /tmp_mnt thing:
  40. # The input would be like /tmp_mnt/Net/sparky/sparky3/henderso
  41.  
  42. if (m#/tmp_mnt(.*)#) {
  43.     @thatdir=stat($1);
  44.     if ($thisdir[2] == $thatdir[2]) { 
  45.         print "$1\n"; 
  46.         exit(1); 
  47.     } 
  48. }
  49.  
  50. # Or possibly, could it be from a NeXT automounter?
  51. # The input would be like /private/Net/sparky/sparky3/henderso
  52.  
  53. if(m#/private(.*)#) {
  54.     @thatdir=stat($1);
  55.     if ($thisdir[2] == $thatdir[2]) {
  56.         print "$1\n";
  57.         exit(2);
  58.     }
  59. }
  60.  
  61. # Maybe we're on a DECstation!
  62. # The input would be like /tmp_mnt/Net/sparky/sparky3/sparky/henderso
  63.  
  64. if(m#/tmp_mnt(/[^/]*/[^/]*/[^/]*)/[^/]*(.*)#) {
  65.     $try=$1.$2;
  66.     @thatdir=stat($try);
  67.     if ($thisdir[2] == $thatdir[2]) {
  68.         print "$try\n";
  69.         exit(3);
  70.     }
  71. }
  72.  
  73. # Evidently it didn't match anything, but we've got to return something:
  74.  
  75. print "$_\n";
  76. exit (0);
  77. ---
  78. Bill Nickless  System Support Group  <nickless@mcs.anl.gov>  +1 708 252 7390
  79.