home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / WAIS / bin / create-public-next.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1992-01-19  |  2.3 KB  |  81 lines

  1. #!/bin/sh
  2. # Enable/disable Internet access to WAIS server on NeXT systems.
  3. # Must be run as root.  Usage:
  4. #
  5. #    create-public-next.sh -on system_wais_folder
  6. #    create-public-next.sh -off
  7. #
  8. # If -on system_wais_folder is given, the script will enable Internet access, 
  9. # through the waisserver program, to WAIS sources contained in
  10. # system_wais_folder (and only those sources).
  11. #
  12. # If -off is given, the script disables Internet WAIS access.
  13. #
  14. WHAT_TO_DO=${1:-"-help"}
  15. SYSTEM_WAIS_FOLDER=${2:-"/!!!NON-EXISTENT!!!/"}
  16. if test $WHAT_TO_DO = "-on"
  17. then
  18.     if test -d $SYSTEM_WAIS_FOLDER
  19.     then
  20.         cd $SYSTEM_WAIS_FOLDER
  21.         SYSTEM_WAIS_FOLDER=`pwd`
  22.         echo "Setting up public WAIS server on $SYSTEM_WAIS_FOLDER..."
  23.         echo
  24.         echo 'Making Z39.50 (WAIS) service known to NetInfo...'
  25.         niutil -create . /services/z3950
  26.         niutil -createprop . /services/z3950 name z3950 WAIS
  27.         niutil -createprop . /services/z3950 port 210
  28.         niutil -createprop . /services/z3950 protocol tcp
  29.         echo '...New NetInfo entry reads:'
  30.         niutil -read . /services/z3950
  31.         echo
  32.         echo 'Setting up Internet Daemon to listen for Z39.50 requests...'
  33.         if cp /etc/inetd.conf /etc/inetd.conf~
  34.         then
  35.             echo '...Backed up inetd.conf file.'
  36.         else
  37.             echo 'ERROR: Cannot back up /etc/inetd.conf'
  38.             exit
  39.         fi
  40.         if test 0 -eq "`grep 'z3950' /etc/inetd.conf | wc -l`";  
  41.         then
  42.             echo "z3950    stream    tcp    nowait    root    $SYSTEM_WAIS_FOLDER/bin/waisserver waisserver.d -d $SYSTEM_WAIS_FOLDER/sources">> /etc/inetd.conf
  43.             echo '...Updated inetd.conf file.'
  44.         else
  45.             echo '...WAIS server already listed in inetd.conf file.'
  46.         fi
  47.     else
  48.         echo "ERROR: No such folder: $SYSTEM_WAIS_FOLDER"
  49.         exit
  50.     fi
  51. elif test $WHAT_TO_DO = "-off"
  52. then
  53.     echo "De-installing public WAIS server..."
  54.     echo    
  55.     echo 'Deleting Z39.50 (WAIS) service from NetInfo...'
  56.     niutil -destroy . /services/z3950
  57.     echo '...Deleted.'
  58.     echo
  59.     echo 'Resetting Internet Daemon to ignore Z39.50 requests...'
  60.     if cp /etc/inetd.conf /etc/inetd.conf~
  61.     then
  62.         echo '...Backed up inetd.conf file.'
  63.     else
  64.         echo 'ERROR: Cannot back up /etc/inetd.conf'
  65.         exit
  66.     fi
  67.     grep -v 'z3950' /etc/inetd.conf~ > /etc/inetd.conf
  68.     echo '...Updated inetd.conf file.'
  69. else
  70.     echo 'Usage:'
  71.     echo '    create-public-next.sh -on system_wais_folder'
  72.     echo '    create-public-next.sh -off'
  73.     exit
  74. fi
  75. echo '...Done.'
  76. echo
  77. echo '*** These changes will take full effect upon system reboot. ***'
  78. echo
  79.  
  80.  
  81.