home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / rn_4_3_blars.lzh / newsetup.SH < prev    next >
Text File  |  1990-08-22  |  5KB  |  209 lines

  1. case $CONFIG in
  2.     '') . ./config.sh ;;
  3. esac
  4. echo "Extracting newsetup (with variable substitutions)"
  5. $spitshell >newsetup <<!GROK!THIS!
  6. $startsh
  7.  
  8. # $Header: newsetup.SH,v 4.3.2.7 90/03/17 20:34:48 sob Exp $
  9. # $Log:    newsetup.SH,v $
  10. # Revision 4.3.2.7  90/03/17  20:34:48  sob
  11. # Remove the /tmp/n.* files created when generating the .newsrc.
  12. # Revision 4.3.2.6  90/03/17  17:26:42  sob
  13. # Some versions of sed only take 9 wfiles.
  14. # Revision 4.3.2.5  89/11/28  01:15:32  sob
  15. # Fixed a bug that caused the active file to be removed on non-NNTP-based
  16. # systems.
  17. # Revision 4.3.2.4  89/11/28  00:31:20  sob
  18. # Changed news.announce.newuser to news.announce.newusers.
  19. # Revision 4.3.2.3  89/11/08  01:13:15  sob
  20. # Finished modifications to make work with RN and RRN
  21. #
  22. # Revision 4.3.2.2  89/11/07  23:25:50  sob
  23. #
  24. # Added support such that RN and RRN can be made from the same sources.
  25. # Revision 4.3.1.2  86/09/05  15:41:04  lwall
  26. # Changes for newsgroup renaming.
  27. # Revision 4.3.1.1  85/05/10  11:35:43  lwall
  28. # Branch for patches.
  29. # Revision 4.3  85/05/01  11:43:05  lwall
  30. # Baseline for release with 4.3bsd.
  31.  
  32. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
  33.  
  34. : syntax: newsetup
  35.  
  36. : System dependencies
  37. : You will want to change the definitions below to reflect the distribution
  38. : areas around you.  If you have more areas than this you will need to modify
  39. : the sed below.
  40.  
  41. locorg="$locpref"
  42. organization="$orgpref"
  43. city="$citypref"
  44. state="$statepref"
  45. cntry="$cntrypref"
  46. cont="$contpref"
  47. #NORMALactive="${active-/usr/lib/news/active}"
  48. #NNTPactive="/tmp/active.\$\$"
  49.  
  50. dotdir="\${DOTDIR-\${HOME-\$LOGDIR}}"
  51. $rm -f \$dotdir/.oldnewsrc
  52. $echo "Creating .newsrc in \$dotdir to be used by news programs."
  53. #NNTPrnlib=$rnlib
  54. #NNTPcase \$rnlib in
  55. #NNTP~*) rnlib=\`$filexp \$rnlib\` ;;
  56. #NNTPesac
  57. #NNTP\$rnlib/getactive \$active
  58. #NORMALcase \$active in
  59. #NORMAL~*) active=\`$filexp \$active\` ;;
  60. #NORMALesac
  61.  
  62. : NOTE: SED WILL NOT TAKE MORE THAN 9 WFILES, SO BEWARE   
  63.  
  64. $sort <\$active | $sed >/tmp/n.tmp\$\$    \\
  65.     -e 's/^\([^ ]*\) .*\$/\1:/'    \\
  66.     -e '/^control:/{'        \\
  67.      -e "  s/:/!/"    \\
  68.     -e "  w /tmp/n.test\$\$"    \\
  69.     -e '  d'            \\
  70.     -e '}'                \\
  71.     -e '/^junk:/{'            \\
  72.      -e "  s/:/!/"    \\
  73.     -e "  w /tmp/n.test\$\$"    \\
  74.     -e '  d'            \\
  75.     -e '}'                \\
  76.     -e '/test:/{'            \\
  77.      -e "  s/:/!/"    \\
  78.     -e "  w /tmp/n.test\$\$"    \\
  79.     -e '  d'            \\
  80.     -e '}'                \\
  81.     -e "/^\$locorg\./{"        \\
  82.     -e "  w /tmp/n.\$locorg\$\$"    \\
  83.     -e '  d'            \\
  84.     -e '}'                \\
  85.     -e "/^\$organization\./{"    \\
  86.     -e "  w /tmp/n.\$organization\$\$"    \\
  87.     -e '  d'            \\
  88.     -e '}'                \\
  89.     -e "/^\$city\./{"        \\
  90.     -e "  w /tmp/n.\$city\$\$"    \\
  91.     -e '  d'            \\
  92.     -e '}'                \\
  93.     -e "/^\$cntry\./{"         \\
  94.     -e "  w /tmp/n.\$cntry\$\$"    \\
  95.     -e '  d'            \\
  96.     -e '}'                \\
  97.     -e "/^\$state\./{"         \\
  98.     -e "  w /tmp/n.\$state\$\$"    \\
  99.     -e '  d'            \\
  100.     -e '}'
  101.  
  102. $sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$    \\
  103.     -e "/^\$cont\./{"         \\
  104.     -e "  w /tmp/n.\$cont\$\$"    \\
  105.     -e '  d'            \\
  106.     -e '}'
  107.  
  108. $sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$    \\
  109.     -e "/^to\./{"            \\
  110.     -e "  s/:/!/"    \\
  111.     -e "  w /tmp/n.to\$\$"        \\
  112.     -e '  d'            \\
  113.     -e '}'                \\
  114.     -e "/^comp\./{"            \\
  115.     -e "  w /tmp/n.comp\$\$"    \\
  116.     -e '  d'            \\
  117.     -e '}'                \\
  118.     -e "/^news\./{"            \\
  119.     -e "  w /tmp/n.news\$\$"    \\
  120.     -e '  d'            \\
  121.     -e '}'                \\
  122.     -e "/^rec\./{"            \\
  123.     -e "  w /tmp/n.rec\$\$"        \\
  124.     -e '  d'            \\
  125.     -e '}'                \\
  126.     -e "/^sci\./{"            \\
  127.     -e "  w /tmp/n.sci\$\$"        \\
  128.     -e '  d'            \\
  129.     -e '}'                \\
  130.     -e "/^soc\./{"            \\
  131.     -e "  w /tmp/n.soc\$\$"        \\
  132.     -e '  d'            \\
  133.     -e '}'                \\
  134.     -e "/\./{"            \\
  135.     -e "  w /tmp/n.misc\$\$"    \\
  136.     -e '  d'            \\
  137.     -e '}'
  138.  
  139.  
  140. if $test -s \$dotdir/.newsrc ; then
  141.     $echo "Saving your current .newsrc as .oldnewsrc..."
  142.     $mv -f \$dotdir/.newsrc \$dotdir/.oldnewsrc
  143. fi
  144.  
  145. : newsrc order determined here
  146.  
  147. $sed <\$active '
  148.     /^to\./d
  149.     s/ .*//
  150.     s/^/ /
  151.     s/^ '\$locorg'\./01&/
  152.     s/^ '\$organization'\./02&/
  153.     s/^ '\$city'\./03&/
  154.     s/^ '\$state'\./04&/
  155.     s/^ '\$cntry'\./05&/
  156.     s/^ '\$cont'\./06&/
  157.     s/^ news\./07&/
  158.     s/^ comp\./08&/
  159.     s/^ sci\./09&/
  160.     s/^ rec\./10&/
  161.     s/^ soc\./11&/
  162.     s/^ talk\./13&/
  163.     s/^ control\$/14&/
  164.     s/^ junk\$/14&/
  165.     s/^ test\$/14&/
  166.     /\.test\$/s/^[0-9]*/14/
  167.     s/^ .*\./12&/
  168.     s/^ /00&/
  169. ' |
  170. $sort -u |
  171. $sed '
  172.     /^14 /!s/\$/:/
  173.     /^14 /s/\$/!/
  174.     s/^[0-9][0-9] //
  175. ' >\$dotdir/.newsrc
  176.  
  177. #NNTP$rm -f \$active
  178. $rm -f /tmp/n.misc\$\$ /tmp/n.sci\$\$ /tmp/n.soc\$\$ /tmp/n.news\$\$ /tmp/n.comp\$\$
  179. $rm -f /tmp/n.\$cont\$\$ /tmp/n.\$city\$\$ /tmp/n.\$cntry\$\$ /tmp/n.\$state\$\$
  180. $rm -f /tmp/n.to\$\$ /tmp/n.\$organization\$\$ /tmp/n.\$locorg\$\$ /tmp/n.test\$\$
  181. $rm -f /tmp/n.tmp\$\$ /tmp/n.local\$\$ /tmp/n.rec\$\$
  182.  
  183. $cat <<'EOH'
  184. Done.
  185.  
  186. If you have never used the news system before, you may find the articles
  187. in news.announce.newusers to be helpful.  There is also a manual entry for rn.
  188.  
  189. To get rid of newsgroups you aren't interested in, use the 'u' command.
  190. Type h for help at any time while running rn.
  191. EOH
  192. !GROK!THIS!
  193. case "$isrrn" in
  194. define)  sed < newsetup -e '/^#NNTP/s/^#NNTP//' -e '/^#NORMAL/d' > newsetup.new ;;
  195. *) sed < newsetup -e '/^#NNTP/d' -e '/^#NORMAL/s/^#NORMAL//' > newsetup.new ;;
  196. esac
  197. mv newsetup.new newsetup
  198. $eunicefix newsetup
  199. chmod 755 newsetup
  200.