home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume25 / finger / part03 / Install.cpp < prev    next >
Text File  |  1992-04-03  |  5KB  |  211 lines

  1. /*
  2.  * Copyright (C) 1988, 1990  Philip L. Budne
  3.  *
  4.  * This file is part of "Phil's Finger Program".
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; either version 1, or (at your option)
  9.  * any later version.
  10.  */
  11.  
  12. /*
  13.  * $Id: Install.cpp,v 3.0 90/07/06 13:09:49 budd Rel $
  14.  */
  15.  
  16. # include "local.h"
  17.  
  18. # ifdef USG
  19. CHOWN=/bin/chown
  20. # else  /* USG not defined */
  21. CHOWN=/etc/chown
  22. # endif /* USG not defined */
  23.  
  24. /* ttyloc program runs setuid */
  25. TTYLOCOWN=daemon
  26.  
  27. /*fingerd must have this path built in (see FINGERPATHS in fingerd.c/local.h)*/
  28. DEST=/usr/local/bin
  29.  
  30. /* you might change this to '1' if you don't have/use manl (local) */
  31. MANSEC='l'
  32. /* base for man files */
  33. MAND=/usr/man
  34.  
  35. /* saved nlist file (finger needs to be in kmem group under 4.3) */
  36. # ifdef KMEM_GROUP
  37. NLISTGRP=KMEM_GROUP
  38. # else  /* KMEM_GROUP not defined */
  39. NLISTGRP=daemon
  40. # endif /* KMEM_GROUP not defined */
  41.  
  42. # ifdef SAVED_NLIST
  43. NFILE=SAVED_NLIST
  44. # else  /* SAVED_NLIST not defined */
  45. NFILE=/etc/finger-saved-nlist
  46. # endif /* SAVED_NLIST not defined */
  47.  
  48. # ifdef NLIST_MODE
  49. NFILEMODE=NLIST_MODE
  50. # else  /* NLIST_MODE not defined */
  51. NFILEMODE=664
  52. # endif /* NLIST_MODE not defined */
  53.  
  54. # ifdef sun
  55. FINGERDDEST=/usr/etc/in.fingerd
  56. FINGERDSOURCE=in.fingerd
  57. # if SunOS < 400
  58. INETDCONF=/etc/servers
  59. # else  /* not SunOS < 400 */
  60. INETDCONF=/etc/inetd.conf
  61. # endif /* not SunOS < 400 */
  62. # else  /* sun not defined */
  63. # ifdef sgi
  64. FINGERDDEST=/usr/etc/fingerd
  65. FINGERDSOURCE=fingerd
  66. INETDCONF=/usr/etc/inetd.conf
  67. # else  /* sgi not defined */
  68. FINGERDDEST=/etc/fingerd
  69. FINGERDSOURCE=fingerd
  70. # ifdef INETD
  71. INETDCONF=/etc/inetd.conf
  72. # endif /* INETD defined */
  73. # endif /* sgi not defined */
  74. # endif /* sun not defined */
  75.  
  76. # ifdef sgi
  77. /* what about other USG systems? */
  78. UCBDIR=/usr/bsd
  79. # else  /* sgi not defined */
  80. UCBDIR=/usr/ucb
  81. # endif /* sgi not defined */
  82.  
  83. echo binary dir is $DEST finger setgid $NLISTGRP
  84. echo manual pages to $MAND section $MANSEC
  85. echo saved namelist is $NFILE group $NLISTGRP mode $NFILEMODE
  86. echo ttyloc dir is TTYLOC_DIR owner $TTYLOCOWN files mode TTYLOC_MODE
  87. echo $FINGERDSOURCE to $FINGERDDEST
  88. echo ''
  89. echo "Type RETURN to continue"
  90. read FOOBAR
  91.  
  92. /* flush groty versions */
  93. if [ -r $UCBDIR/finger ]; then
  94.     echo moving $UCBDIR/finger to $UCBDIR/ofinger
  95.     mv $UCBDIR/finger $UCBDIR/ofinger
  96. fi
  97. if [ -r $UCBDIR/f ]; then
  98.     echo moving $UCBDIR/f to $UCBDIR/of
  99.     mv $UCBDIR/f $UCBDIR/of
  100. fi
  101. if [ -r $UCBDIR/whois ]; then
  102.     echo moving $UCBDIR/whois to $UCBDIR/nicname
  103.     mv $UCBDIR/whois $UCBDIR/nicname
  104. fi
  105.  
  106. echo ''
  107. echo installing $DEST/finger setgid $NLISTGRP
  108. cp xf $DEST/finger
  109. # ifndef NOSTRIP
  110. strip $DEST/finger
  111. # endif /* NOSTRIP not defined */
  112. chgrp $NLISTGRP $DEST/finger
  113. chmod 2711 $DEST/finger
  114. ls -lg $DEST/finger
  115.  
  116. for x in whois whoj f; do
  117.     if [ ! -r $DEST/$x ]; then
  118.         echo linking $DEST/$x to $DEST/finger
  119.         (cd $DEST; ln -s finger $x)
  120.     fi
  121.     ls -l $DEST/$x
  122. done
  123.  
  124. echo ''
  125. if [ ! -r $NFILE ]; then
  126.     echo creating empty $NFILE
  127.     touch $NFILE
  128. fi
  129. chgrp $NLISTGRP $NFILE
  130. chmod $NFILEMODE $NFILE
  131. ls -lg $NFILE
  132.  
  133. echo ''
  134. echo installing $FINGERDSOURCE as $FINGERDDEST
  135. cp $FINGERDSOURCE $FINGERDDEST
  136. # ifndef NOSTRIP
  137. strip $FINGERDDEST
  138. # endif /* NOSTRIP not defined */
  139. # ifdef INETD
  140. echo "Checking $INETDCONF"
  141. if grep finger $INETDCONF; then
  142.     true;
  143. else
  144.     echo "Perhaps you should to edit $INETDCONF"
  145. fi
  146. # else  /* INETD not defined */
  147. echo "Checking /etc/rc files"
  148. if grep /etc/fingerd /etc/rc*; then
  149.     true;
  150. else
  151.     echo "You might want to start fingerd from /etc/rc.local"
  152. fi
  153. # endif /* INETD not defined */
  154.  
  155. echo ''
  156. echo installing $DEST/ttyloc setuid $TTYLOCOWN
  157. cp ttyloc $DEST
  158. # ifndef NOSTRIP
  159. strip $DEST/ttyloc
  160. # endif /* NOSTRIP not defined */
  161. $CHOWN $TTYLOCOWN $DEST/ttyloc
  162. chmod 4711 $DEST/ttyloc
  163. ls -lg $DEST/ttyloc
  164.  
  165. echo ''
  166. echo installing $DEST/ttyask
  167. cp ttyask $DEST
  168. # ifndef NOSTRIP
  169. strip $DEST/ttyask
  170. # endif /* NOSTRIP not defined */
  171. (
  172.     cd $DEST
  173.     ls -lg ttyask
  174.     for x in ttyplace ttyroom ttyrandom ttycycle; do
  175.     rm -f $x
  176.     echo linking $x to ttyask
  177.     ln -s ttyask $x
  178.     ls -l $x
  179.     done
  180. )
  181.  
  182. # ifdef TTYLOC_DIR
  183. echo ''
  184. if [ ! -d TTYLOC_DIR ]; then
  185.     echo creating TTYLOC_DIR
  186.     mkdir TTYLOC_DIR
  187. fi
  188. $CHOWN $TTYLOCOWN TTYLOC_DIR
  189. ls -lgd TTYLOC_DIR
  190. # else  /* TTYLOC_DIR not defined */
  191. echo 'TTYLOC_DIR not defined in local.h!!' 1>&2
  192. # endif /* TTYLOC_DIR not defined */
  193.  
  194. # ifdef USG
  195. echo ''
  196. echo installing man uptime in $UCBDIR/uptime
  197. cp uptime $UDBDIR/uptime
  198. # endif /* USG defined */
  199.  
  200. echo ''
  201. echo installing man pages
  202. cp finger.1    $MAND/man$MANSEC/finger.$MANSEC
  203. cp ttyloc.1    $MAND/man$MANSEC/ttyloc.$MANSEC
  204. cp nttyloc.5    $MAND/man5
  205. cp finger.conf.5 $MAND/man5
  206. cp fingerd.8c    $MAND/man8
  207.  
  208. echo ''
  209. echo 'taking it out for a spin!'
  210. $DEST/finger
  211.