home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst 1995 September to December / CDware_Sep-Dec_1995.bin / cdware
Text File  |  1995-10-26  |  10KB  |  369 lines

  1. #!/bin/sh 
  2. #
  3. # The following CDware script launches httpd, waissearch, and hotjava 
  4. # on Solaris SPARC, Solaris x86, and SunOS
  5.  
  6. # Author: Marc Sacoolas (marc.sacoolas@sun.com)
  7. #   Date: April 4, 1995
  8.  
  9. # initialize variables
  10.  
  11. dir_exist=0
  12. echo ""
  13. echo "          Catalyst CDware initializing ..."
  14. echo ""
  15.                         
  16.  
  17.  
  18. # set CDMOUNT to path from the command line arguements
  19. CDMOUNT=`expr \
  20.         $0'/' : '\(/\)[^/]*//*$' \
  21.         \| $0'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \
  22.         \| .`
  23. # if command line path is current directory then set CDMOUNT to pwd
  24. # CDMOUNT cannot be set to . because other programs/scripts
  25. # need the absolute path in CD_MOUNT
  26. if [ "$CDMOUNT" = "." ]; then
  27.         CDMOUNT=`pwd`
  28. fi
  29. CD_MOUNT=$CDMOUNT
  30.  
  31. export CD_MOUNT
  32.  
  33.  
  34. #
  35. # os type and arch
  36. #
  37. check_os()
  38. {
  39.         os_ver="`/bin/uname -r | /bin/grep 5\[.]`"
  40.  
  41.         export os_ver
  42.  
  43.         if [ -n "$os_ver" ]; then
  44. # must be running Solaris 2.x
  45.                 machine_type="`/bin/uname -m`"
  46.                 os_type="`/bin/uname -r`"
  47.                 if [ "$machine_type" = "i86pc" ]; then
  48.                         OS_TYPE=""
  49.                         GUI=.products/bin/Solaris_2_x86/Prism/prism
  50.                         GUI_BIN=prism
  51.                         CDWARE_ENV=Solaris_x86
  52.                 else
  53. # must be on a SPARCarchitecture-based machine
  54.                         bcp="`/bin/pkginfo | /bin/grep SUNWbcp`"
  55.                         if [ "$GUI_BIN" = "cdmgr" ]; then
  56.                           GUI=.products/bin/Solaris_2/cdmanager
  57.                         else
  58.                           GUI=.products/bin/Solaris_2/Prism/prism
  59.                         fi
  60. # check for bcp and set CDWARE_ENV accordingly???
  61.                         CDWARE_ENV=Solaris_2
  62.                 fi
  63.         else
  64. # must be running Solaris 1.x
  65.                 GUI=.products/bin/Solaris_1/cdmanager
  66.                 GUI_BIN=cdmgr
  67.                 CDWARE_ENV=Solaris_1
  68.         fi
  69.  
  70. #
  71. # CDWARE_HOME used by screendemo, slidecacher, and seaudio
  72. #
  73. CDWARE_HOME=$CDMOUNT/.products/bin/$CDWARE_ENV$OS_TYPE
  74.  
  75. export GUI CDWARE_ENV CDWARE_HOME OS_TYPE
  76. }
  77. # print out legal text as required by the lawyers
  78. echo " "    
  79. cat $CD_MOUNT/.products/CDware/legal.txt
  80.  
  81.  
  82. check_os
  83.  
  84. #
  85. # If runs on SunOS, display the warning window
  86. #
  87. if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  88.     $CD_MOUNT/.products/.bin/httpd/$CDWARE_ENV/warning
  89.     if [ "$?" = "1" ]; then
  90.         echo "Exiting ..."
  91.         exit
  92.     fi
  93. fi
  94.         
  95.  
  96. # set the path hotjava looks for its extended browser classes
  97. if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  98.  
  99. XNLSPATH=$CD_MOUNT/.products/hotjava/Solaris_1/usr/local/X11R5/lib/X11/nls
  100. export XNLSPATH
  101.  
  102. fi
  103.  
  104. export LD_LIBRARY_PATH HOTJAVA_HOME CLASSPATH PATH
  105.  
  106. LD_LIBRARY_PATH=$CD_MOUNT/.products/hotjava/$CDWARE_ENV/lib:/usr/openwin/lib:/usr/slib:/usr/lib
  107. HOTJAVA_HOME=$CD_MOUNT/.products/hotjava
  108. CLASSPATH=$CD_MOUNT/.products/hotjava/classes:$CD_MOUNT/.products/CDware/classes
  109. if [ "$CDWARE_ENV" = "Solaris_1" ]; then
  110. PATH=$PATH:$CD_MOUNT/.products/hotjava/$CDWARE_ENV/bin:/tmp/httpd/.cgi-bin:/usr/ucb:/usr/bin:/usr/sbin
  111. else
  112. PATH=$PATH:$CD_MOUNT/.products/hotjava/$CDWARE_ENV/bin:/tmp/httpd/.cgi-bin:/usr/bin:/usr/sbin
  113. fi
  114.  
  115. # play welcome audio clip
  116.  
  117. if [ $CDWARE_ENV != "Solaris_1" ]; then
  118.     audioplay -i $CD_MOUNT/.products/CDware/sounds/welcome.au&
  119. else
  120.     cat $CD_MOUNT/.products/CDware/sounds/welcome.au > /dev/audio&
  121. fi
  122. # set the dir where all the companies live
  123.  
  124. PRODUCT_DIR=$CD_MOUNT/.products
  125. export PRODUCT_DIR 
  126.  
  127. #WWW_HOME=$CDMOUNT/.products/CDware/
  128. #export WWW_HOME
  129.  
  130. # if "/tmp/.wais" symlink is not already there, then
  131. # create link for wais-src and wais on CDrom
  132.  
  133. if [ ! -h /tmp/.wais ]; then
  134.     ln -s $PRODUCT_DIR/.wais /tmp
  135. fi
  136.  
  137. # move only needed files and symlink for "file" URLs, if necessary
  138.  
  139. if [ ! -d /tmp/httpd ]; then
  140.     mkdir /tmp/httpd
  141.     mkdir /tmp/httpd/bin
  142.     mkdir /tmp/httpd/conf
  143.     cp -r $CD_MOUNT/.products/.bin/httpd/conf /tmp/httpd&
  144.     cp -r $CD_MOUNT/.products/.bin/httpd/logs /tmp/httpd&
  145.  
  146.     ln -s $PRODUCT_DIR /tmp/httpd 
  147. fi
  148.  
  149. # check for mailcap file
  150.  
  151.  
  152. if [ -r $HOME/.mailcap ]; then
  153.     cp $HOME/.mailcap  $HOME/.mailcap.cdware
  154.     echo "application/x-spam-sh; /bin/sh %s " >> $HOME/.mailcap
  155.  
  156. else 
  157.     echo "application/x-spam-sh; /bin/sh %s " > $HOME/.mailcap
  158. fi
  159. # needed srm.conf doc for httpd conf
  160.  
  161. echo ""
  162. echo "     NCSA World Wide Web server initializing ..."        
  163. echo ""
  164. echo "        Portions developed at the National Center"
  165. echo "        for Supercomputing Applications at the"
  166. echo "        University of Illinois at Urbana-Champaign."    
  167. echo ""    
  168.  
  169. if [ ! -h /tmp/httpd/.cgi-bin ]; then
  170.     ln -s $PRODUCT_DIR/.bin/httpd/$CDWARE_ENV /tmp/httpd/.cgi-bin
  171. fi
  172.  
  173. wais_conf()
  174.  
  175. {
  176.  
  177. echo "DocumentRoot $CD_MOUNT/.products" >> /tmp/httpd/conf/srm.conf
  178. echo 'UserDir public_html' >> /tmp/httpd/conf/srm.conf
  179. echo 'DirectoryIndex index.html' >> /tmp/httpd/conf/srm.conf
  180. echo 'FancyIndexing on' >> /tmp/httpd/conf/srm.conf
  181.  
  182. echo 'AddType application/x-spam-sh .sh' >> /tmp/httpd/conf/srm.conf
  183. echo 'AddIconByType (TXT,/icons/text.xbm) text/*' >> /tmp/httpd/conf/srm.conf
  184. echo 'AddIconByType (IMG,/icons/image.xbm) image/*' >> /tmp/httpd/conf/srm.conf
  185. echo 'AddIconByType (SND,/icons/sound.xbm) audio/*' >> /tmp/httpd/conf/srm.conf
  186. echo 'AddIcon /icons/movie.xbm .mpg .qt' >> /tmp/httpd/conf/srm.conf
  187. echo 'AddIcon /icons/binary.xbm .bin' >> /tmp/httpd/conf/srm.conf
  188.  
  189. echo 'AddIcon /icons/back.xbm ..' >> /tmp/httpd/conf/srm.conf
  190. echo 'AddIcon /icons/menu.xbm ^^DIRECTORY^^' >> /tmp/httpd/conf/srm.conf
  191. echo 'AddIcon /icons/blank.xbm ^^BLANKICON^^' >> /tmp/httpd/conf/srm.conf
  192.  
  193. echo 'DefaultIcon /icons/unknown.xbm' >> /tmp/httpd/conf/srm.conf
  194.  
  195. echo 'ReadmeName README' >> /tmp/httpd/conf/srm.conf
  196. echo 'HeaderName HEADER' >> /tmp/httpd/conf/srm.conf
  197.  
  198. echo 'IndexIgnore */.??* *~ *# */HEADER* */README*' >> /tmp/httpd/conf/srm.conf
  199.  
  200. echo 'AccessFileName .htaccess' >> /tmp/httpd/conf/srm.conf
  201.  
  202. echo 'DefaultType text/plain' >> /tmp/httpd/conf/srm.conf
  203.  
  204. echo "Alias /icons/ $CD_MOUNT/.products/.bin/httpd/icons/" >> /tmp/httpd/conf/srm.conf
  205. echo "Alias http:/ $CD_MOUNT/.products/.bin/httpd/cache_root/" >> /tmp/httpd/conf/srm.conf
  206. echo "Alias  /localhost:8001/ /$hostname:8001/" >> /tmp/httpd/conf/srm.conf
  207.  
  208. echo "ScriptAlias /cgi-bin/ $CD_MOUNT/.products/.bin/httpd/cgi-bin/" >> /tmp/httpd/conf/srm.conf
  209. echo "ScriptAlias /run/ $CD_MOUNT/.products/" >> /tmp/httpd/conf/srm.conf
  210.  
  211.  
  212.  
  213. # generate access.conf file
  214.  
  215.  
  216.  
  217. echo '<Directory /tmp/httpd/>' >> /tmp/httpd/conf/access.conf
  218. echo 'Options Indexes FollowSymLinks' >> /tmp/httpd/conf/access.conf
  219.  
  220.  
  221. echo '</Directory>' >> /tmp/httpd/conf/access.conf
  222.  
  223. echo "<Directory $CD_MOUNT/.products/*>" >> /tmp/httpd/conf/access.conf
  224.  
  225. echo 'Options Indexes FollowSymLinks ExecCGI' >> /tmp/httpd/conf/access.conf
  226.  
  227. echo 'AllowOverride All' >> /tmp/httpd/conf/access.conf
  228.  
  229. echo '<Limit GET>' >> /tmp/httpd/conf/access.conf
  230. echo 'order allow,deny' >> /tmp/httpd/conf/access.conf
  231. echo 'allow from all' >> /tmp/httpd/conf/access.conf
  232. echo '</Limit>' >> /tmp/httpd/conf/access.conf
  233.  
  234. echo '</Directory>' >> /tmp/httpd/conf/access.conf
  235.  
  236.  
  237.  
  238. # generate  imagemap.conf
  239.  
  240. #echo "     :     " > /tmp/httpd/conf/imagemap.conf
  241.  
  242. # make link to *real* cgi-bin dirctory
  243.  
  244.  
  245. # Check to see if the user is root, if so, change to
  246. # "-nobody" 
  247. #
  248.  
  249. USER=`/usr/ucb/whoami`
  250. if [ "$USER" = "root" ]; then
  251.     echo "User nobody" >>/tmp/httpd/conf/httpd.conf-dist
  252.     echo "Group nobody" >>/tmp/httpd/conf/httpd.conf-dist
  253. fi
  254.  
  255. #launch httpd
  256.  
  257. $CD_MOUNT/.products/.bin/httpd/cgi-bin/httpd -f /tmp/httpd/conf/httpd.conf-dist
  258. }
  259.  
  260. wais_conf&
  261.  
  262.  
  263. # launch wais search deamen
  264. echo "     Launching Catalyst Catalog WAIS server ..."
  265. echo ""
  266. echo "        Copyright (c) MCNC, Clearinghouse for Networked"
  267. echo "        Information Discovery and Retrieval, 1993."
  268.  
  269.  
  270. $CD_MOUNT/.products/.bin/httpd/cgi-bin/waisserver -p 7998 -d $CD_MOUNT/.products/.wais/wais >/tmp/waisserver.log 2>&1 &
  271.  
  272. pid=$!
  273.  
  274. # launch hotJAVA 
  275. # place .hotjava in home to  void initial pop-up window
  276. echo "        Launching HotJava browser ..."
  277. echo ""
  278. echo "        Catalyst CDware demos and trial software"
  279. echo "        as well as the World Wide Web are brought"
  280. echo "        to you through HotJava."
  281. echo ""
  282. echo "        NOTE: If you have internet access through" 
  283. echo "        a fire-wall, you may have to set a \"proxy\""
  284. echo "        server under \"options\" in HotJava." 
  285.  
  286.  
  287. if [ -d $HOME/.hotjava ]; then
  288.   mv $HOME/.hotjava $HOME/.hotjava.cdware
  289.   cp -r $CD_MOUNT/.products/hotjava/.hotjava $HOME
  290.   dir_exist=1
  291. else
  292.   cp -r $CD_MOUNT/.products/hotjava/.hotjava $HOME
  293.   dir_exist=0
  294. fi
  295.  
  296. echo ""
  297. echo "Please wait, Catalyst CDware is starting ..."
  298. echo ""
  299. echo "Please note the following:" 
  300. echo "--------------------------" 
  301. echo "- To run many of the slide shows there must be at least 5 megabytes" 
  302. echo "  of available disk space in /tmp.  Please verify the available disk" 
  303. echo "  space in /tmp before running the slide shows." 
  304. echo " " 
  305. echo " " 
  306.  
  307. #$CD_MOUNT/.products/hotjava/$CDWARE_ENV/bin/hotjava http://localhost:7999/CDware
  308.  
  309. $CD_MOUNT/.products/.bin/httpd/$CDWARE_ENV/welcome 120 &
  310. $CD_MOUNT/.products/hotjava/$CDWARE_ENV/bin/hotjava file:///tmp/httpd/.products/CDware/index.html
  311.  
  312. #
  313. # clean-up
  314. #
  315. if [ $CDWARE_ENV != "Solaris_1" ]; then
  316.         audioplay -i $CD_MOUNT/.products/CDware/sounds/bye.au&
  317. else
  318.         cat $CD_MOUNT/.products/CDware/sounds/bye.au > /dev/audio&
  319. fi
  320.  
  321. # restore mailcap file
  322. if [ -r $HOME/.mailcap.cdware ]; then
  323. mv $HOME/.mailcap.cdware $HOME/.mailcap
  324. fi
  325.  
  326. # mail or print more information request
  327.  
  328. if [ -r /tmp/httpd/info.email ]; then
  329.      echo "------------------------------" >> /tmp/httpd/info.email
  330.   /usr/ucb/mail -s "CDware Lead for Your Product" < /tmp/httpd/info.email cdwareemlts@sun.com 
  331. fi
  332. if [ -r /tmp/httpd/info.fax ]; then  
  333.      echo "------------------------------" >> /tmp/httpd/info.fax
  334.      echo "" >> /tmp/httpd/info.fax
  335.      echo "FAX US! at (415)961-6070" >> /tmp/httpd/info.fax
  336.      echo "" >> /tmp/httpd/info.fax
  337.      echo "------------------------------" >> /tmp/httpd/info.fax
  338.       /usr/ucb/lpr /tmp/httpd/info.fax
  339. fi
  340.  
  341.  
  342.  
  343. # kill httpd
  344.  
  345. kill -9 `cat /tmp/httpd/logs/httpd.pid`
  346.  
  347.  
  348. # Clean up wais stuff:kill wais, remove link
  349.  
  350. rm -f /tmp/.wais /tmp/waisserver.log 
  351. kill -9 $pid
  352.  
  353.  
  354. # remove httpd config
  355.  
  356. rm -rf /tmp/httpd
  357.  
  358. # remove .hotjava
  359.  
  360. if [ "$dir_exist" = "1" ]; then
  361.   rm -r $HOME/.hotjava
  362.   mv $HOME/.hotjava.cdware $HOME/.hotjava
  363. else 
  364.   rm -rf $HOME/.hotjava
  365. fi
  366.  
  367.  
  368. exit 0
  369.