rsalz@uunet.uu.net (Rich Salz) (06/27/89)
Submitted-by: utzoo!henry Posting-number: Volume 19, Issue 79 Archive-name: cnews2/part02 [ The install.out file is not that big, and it contains some long lines and embedded backspace characters. It's here for convenience; shipping formatted documents is not my standard practice. --r$ ] : ---CUT HERE--- echo 'doc/install.out': sed 's/^X//' >'doc/install.out' <<'!' X X X X X X X X X X IIIInnnnssssttttaaaalllllllliiiinnnngggg ````````CCCC NNNNeeeewwwwssss'''''''' NNNNeeeettttwwwwoooorrrrkkkk NNNNeeeewwwwssss SSSSooooffffttttwwwwaaaarrrreeee X X X Geoff Collyer X X Department of Statistics X University of Toronto X X X X X X X This document describes the flow of network news X within and between machines, what each component of C X news does, and how to install C news. X X X XIIIInnnnttttrrrroooodddduuuuccccttttiiiioooonnnn X X Network news (or _n_e_t_n_e_w_s for short) consists of a collection Xof messages formatted similarly to ARPAnet mail (see ARPA Inter- Xnet RFC 1036 for details), widely spread. The logical network, Ximposed on top of various real networks, formed by the set of all Xinterconnected sites exchanging network news is called ``Usenet'' Xand was formed in 1979, radiating out from Duke University. Net- Xnews is propagated between cooperating machines by a flooding Xalgorithm, with some loop prevention heuristics: each machine Xsends its neighbours news that the neighbours have (probably) not Xyet seen. X X Flow of netnews between machines may be achieved by use of Xany network which can transmit an arbitrary stream of (at least X7-bit) ASCII code, unmodified. If a network cannot transmit XASCII intact (e.g. BITNET), it is possible to encode netnews Xbefore transmission across the network and decode it upon recep- Xtion from the network. Since one cannot be certain that one's Xnetwork neighbours will be up and reachable at all times, outgo- Xing netnews must be queued, at least in the case of network trou- Xble. To date, at least these networks, protocols and media have Xbeen used to transmit netnews correctly: UUCP, RS232, NNTP, Eth- Xernet(Reg), the ARPA Internet, Datakit(Reg), ACSnet, magnetic Xtape, SMTP, and BITNET, though at least the last two require some Xform of encapsulation to avoid corruption of articles; SMTP Xbecause some common implementations get the newline-CRLF mappings Xwrong, thus throwing off byte counts in batches, and BITNET Xbecause of its Procrustean chopping, expanding, mapping, bashing Xand smashing of all data sent through it (sending lines of 80 or Xfewer characters of letters of either case and digits and plus Xand minus appears to be safe). X X X X X X X X X - 2 - X X X X Netnews arrives via some network, which causes a command to Xbe executed upon arrival (e.g. _r_n_e_w_s). _r_n_e_w_s typically spools Xthe inbound netnews for later processing. Eventually (often Xwithin the hour or at the end of the business day), the input Xqueue is run and the netnews is stored locally, typically under X/_u_s_r/_s_p_o_o_l/_n_e_w_s, and queued for transmission to netnews neigh- Xbours. Once stored on disk, netnews may be read by any of a col- Xlection of unprivileged news readers, including _c_a_t(1). _E_x_p_i_r_e Xis run typically each night to remove old netnews from disk. X X C News was originally written to provide a much faster and Xsmaller, more robust, reliable and correct implementation of net- Xnews software than B 2.11 news. We believe that C News is also Xfaster, smaller and more robust than B 3.0 news. B 3.0 news has Xmany more features; take that as you will. X XCCCC NNNNeeeewwwwssss CCCCoooommmmppppoooonnnneeeennnnttttssss.... X X _R_n_e_w_s invokes the input subsystem, which spools incoming Xnetnews in its original form, as received, typically in Xcompressed batches. Periodically, the input queue should be run Xby invoking _n_e_w_s_r_u_n, thus uncompressing any compressed input and Xfeeding it to _r_e_l_a_y_n_e_w_s. X X _R_e_l_a_y_n_e_w_s files incoming netnews as articles on disk and Xinitiates spooled transmission to other machines, often by simply Xwriting the names of the disk files containing the articles on Xthe ends of `batch' files of file names. Quite a bit of policy Xfrom RFC 1036 is embedded in _r_e_l_a_y_n_e_w_s. _i_n_e_w_s is a complex Xfront-end for _r_e_l_a_y_n_e_w_s which implements much of the per-site Xpolicy on news posting. _i_n_e_w_s is a fairly-slow shell script Xwhich is adequately fast for most sites, but it will need to be Xreplaced by something more streamlined for sites which gateway Xmailing lists into netnews, for example. X X The output _b_a_t_c_h_e_r reads lists of file names and generates Xnews batches (see RFC 1036 or _n_e_w_s(5) for the format) of Xprescribed sizes and queues the batches for transmission to other Xsites. The batcher is run asynchronously with _r_e_l_a_y_n_e_w_s, typi- Xcally once an hour outside of business hours. X X _E_x_p_i_r_e is generally run once per night to remove from disk Xnews articles older than a few days. _E_x_p_i_r_e can use different Xexpiry criterion for different newsgroups and can archive arti- Xcles instead of removing them. _E_x_p_i_r_e also runs asynchronously Xwith _r_e_l_a_y_n_e_w_s. X X There are many news readers. C News comes with a limited Xnews reader (_r_e_a_d_n_e_w_s by Michael Rourke) sufficient to replace Xlong-winded /_e_t_c/_m_o_t_ds but you will want a heavy-duty news reader Xif you plan to read more than local news groups. We recommend _r_n Xby Larry Wall, available from your netnews neighbours or your Xnearby ccccoooommmmpppp....ssssoooouuuurrrrcccceeeessss....uuuunnnniiiixxxx archive site. There are others: _v_n and X_v_n_e_w_s are two. X X X X X X X X X - 3 - X X X XPPPPrrrreeeeppppaaaarrrraaaattttiiiioooonnnn ffffoooorrrr IIIInnnnssssttttaaaallllllllaaaattttiiiioooonnnn X X Netnews consumes a lot of disk space and often a lot of Xtransmission time. Here are some relevant measurements regarding Xa full netnews feed as of the time of writing (January 1989), Xtaken from _n_e_w_s._l_i_s_t_s: a day's netnews is about 3Mb and 1,400 Xarticles in 450 newsgroups. Years ago, sites often kept 14 days Xof netnews on disk, but now many sites keep news for 3 to 5 days, Xthus allowing for the occasional long weekend. Thus a full news Xfeed expired after 4 days will consume about 12Mb. Some people Xfeel that news volume is doubling roughly every 16 months. If Xthis is true, we can expect volume to increase by a factor of 10 Xin about 4 years to 30Mb per day or 115Mb for 4 days. It is thus Xwise planning to set aside a lot of disk space for netnews. XThere are two ways to cope with ever-increasing volumes of net- Xnews: refuse to accept more newsgroups, or expire news after Xshorter intervals on disk. A current full feed takes just over 7 Xhours to transmit at 1200 baud, so for dial-up connections one Xclearly wants the fastest modems one can afford. X X Clearly, transmitting a full news feed is a non-trivial com- Xmitment of resources, so you may have some difficulty in finding Xa site willing to supply one. Such a site may in turn expect you Xto feed yet other sites. You will need to agree with your pros- Xpective netnews neighbour(s) upon transfer media, protocols and Xnetworks. X X Before proceeding to install C News, you should read this Xdocument through to the end, probably read the companion document X_T_h_e _I_n_t_e_r_f_a_c_e _B_e_t_w_e_e_n _C _N_e_w_s _A_n_d _T_h_e _O_u_t_s_i_d_e _W_o_r_l_d, and possibly Xread selected items in the _C _N_e_w_s _I_m_p_l_e_m_e_n_t_o_r'_s _N_o_t_e_b_o_o_k and the Xmanual pages. X X You will need to assign a user id and group id to netnews X(often new ids called ``news''); initialise these directories: XNEWSCTL (typically ////uuuussssrrrr////lllliiiibbbb////nnnneeeewwwwssss), NEWSBIN (////uuuussssrrrr////lllliiiibbbb////nnnneeeewwwwssssbbbbiiiinnnn), Xand NEWSARTS (////uuuussssrrrr////ssssppppoooooooollll////nnnneeeewwwwssss); and install each subsystem. XNEWSCTL and NEWSARTS are logically one subtree, defining a news Xdata base, but are split for backward compatibility with older Xnews software, particularly old news readers. NEWSBIN contains Xprograms and shell scripts which might be common amongst machines Xsharing a common architecture (e.g. Sun 3's); NEWSCTL////bbbbiiiinnnn may Xoverride these. The goal is to install the subsystems, integrate Xthem into a working news system, and configure the news system to Xcommunicate with other news systems. X X There are a few key files that must exist before any serious Xattempt may be made to operate the news software. NEWSCTL////aaaaccccttttiiiivvvveeee Xis the list of newsgroups that this site knows (is willing to Xaccept or individually reject), and must be owned by the NEWS Xuserid (the userid that owns NEWSBIN////rrrreeeellllaaaayyyy////rrrreeeellllaaaayyyynnnneeeewwwwssss, typically X_n_e_w_s). You will probably want to get your initial aaaaccccttttiiiivvvveeee file Xfrom your upstream feed and edit it to suit the set of groups you Xwish to receive. Be sure to make the second field more than five X X X X X X X X X - 4 - X X X Xdigits wide, by adding leading zeroes (ten digits is a conserva- Xtive width). NEWSCTL////ssssyyyyssss defines the newsgroups that this site Xis willing to accept and describes how they are to be forwarded Xto its neighbours. NEWSCTL////sssseeeerrrrvvvveeeerrrr contains the hostname of your Xfile server, if you have multiple machines sharing news via a Xnetwork file system. NEWSCTL////wwwwhhhhooooaaaammmmiiii similarly contains the name Xby which a cluster of machines sharing news is to be known for Xpurposes of news. NEWSCTL////mmmmaaaaiiiillllnnnnaaaammmmeeee is optional and contains the Xfull (possibly dotted) name by which your cluster is known for Xpurposes of mail. NEWSCTL////oooorrrrggggaaaannnniiiissssaaaattttiiiioooonnnn (or NEWSCTL////oooorrrrggggaaaannnniiiizzzzaaaattttiiiioooonnnn Xif you insist) contains the name of your organisation, which will Xbe copied into the OOOOrrrrggggaaaannnniiiizzzzaaaattttiiiioooonnnn:::: header of articles posted Xlocally, by default. NEWSCTL////mmmmaaaaiiiillllppppaaaatttthhhhssss defines mail routes to Xmachines which contain aliases for postings to moderated news- Xgroups. NEWSCTL////lllloooogggg, NEWSCTL////eeeerrrrrrrrlllloooogggg, NEWSCTL////hhhhiiiissssttttoooorrrryyyy, XNEWSCTL////hhhhiiiissssttttoooorrrryyyy....ddddiiiirrrr, and NEWSCTL////hhhhiiiissssttttoooorrrryyyy....ppppaaaagggg must exist and be Xowned by the NEWS userid. Tentative versions of all these files Xare built by the installation procedures, but it is quite likely Xthat you'll have to edit some of them. X XCCCC NNNNeeeewwwwssss IIIInnnnssssttttaaaallllllllaaaattttiiiioooonnnn X X Proceed to the ccccoooonnnnffff directory of the distribution. There is Xa major shell file here, named bbbbuuuuiiiilllldddd, that will interrogate you Xat length and construct shell files to do the real work. You may Xneed to do ``chmod +x build'' before running it, to make it exe- Xcutable. X X You will probably need your system's manuals on hand to Xanswer bbbbuuuuiiiilllldddd's questions. Another terminal (or another window, Xon a bitmap display) would also be useful. You'd best be Xprepared to take notes, also, as bbbbuuuuiiiilllldddd will occasionally suggest Xthat something be checked when you're done. X X BBBBuuuuiiiilllldddd itself does not alter any files or perform any instal- Xlation chores: all it does is create shell files in the ccccoooonnnnffff Xdirectory. If you already know something about news software, or Xare merely suspicious that bbbbuuuuiiiilllldddd hasn't done everything right, Xyou should probably read the shell files before running them. XThere are four of them: ddddooooiiiitttt....rrrrooooooootttt, ddddooooiiiitttt....bbbbiiiinnnn, ddddooooiiiitttt....nnnneeeewwwwssss, and Xaaaaggggaaaaiiiinnnn....rrrrooooooootttt. X X DDDDooooiiiitttt....rrrrooooooootttt sets up the major directories for news, and sets Xtheir ownerships correctly. It typically will have to be run as X_r_o_o_t to have adequate permissions for all of this. It is brief. X X DDDDooooiiiitttt....bbbbiiiinnnn does most of the work of building and installing Xthe programs. It should be run as the user who owns the distri- Xbution directories and will own the executable programs under XNEWSBIN. X X DDDDooooiiiitttt....nnnneeeewwwwssss does some other small chores and installs control Xfiles. If any of the control files already exist, it will com- Xplain and refuse to overwrite them, as a safety precaution. It X X X X X X X X X - 5 - X X X Xshould be run as the owner of the news files. Since many of the Xfiles it is installing are built by ddddooooiiiitttt....bbbbiiiinnnn, that should be run Xfirst. X X Finally, aaaaggggaaaaiiiinnnn....rrrrooooooootttt tends to ownership and permission Xchanges on a few programs that need to run set-userid. It Xrequires the ability to change ownerships and to set permissions Xon the files afterwards, which usually means running it as _r_o_o_t. XIt too is brief. X X There are undoubtedly strange systems out there that bbbbuuuuiiiilllldddd Xand friends are not smart enough to cope with. In such cases it Xwill be necessary to edit the shell files before running them, or Xto use them as guides and do the work by hand. In particular, Xsystems that require strange options in MMMMaaaakkkkeeeeffffiiiilllleeees will need to Xhave those inserted by hand. X X If you want to test pieces of C News without installing Xthem, some (not all) of the subsystems have a ``make r'' feature Xthat runs a regression test. Note: almost all of these require Xthat NEWSCTL////bbbbiiiinnnn////ccccoooonnnnffffiiiigggg, or its local equivalent, be in place Xalready so that shell files can find out what PATH (etc.) they Xshould be using. X X Note that it is easy to build a test news system which is Xcompletely independent of other existing news systems on the same Xmachine, or to build one which shares its NEWSBIN with another C Xnews system, or shares input of articles (e.g. running an old B Xnews system and a new C news system off the same stream of input Xuntil you are confident that your new C news system is operating Xto your satisfaction). See _s_u_b_s_t(1) for the mechanism which per- Xmits quickly changing all the places that know the location of XNEWSCTL////bbbbiiiinnnn////ccccoooonnnnffffiiiigggg.... After that, edit this news system's XNEWSCTL////bbbbiiiinnnn////ccccoooonnnnffffiiiigggg and things should be set up for separate Xexistence. X XFFFFiiiirrrrsssstttt NNNNeeeewwwwssss X X When you arrange to get a news feed from your neighbor, you Xshould also ask him to send you the current set of articles in Xthe newsgroup nnnneeeewwwwssss....aaaannnnnnnnoooouuuunnnncccceeee....nnnneeeewwwwuuuusssseeeerrrrssss. Several of these are very Ximportant reading for people who are new to the net. X XUUUUnnnnuuuussssuuuuaaaallll SSSSyyyysssstttteeeemmmmssss X X We believe that C News runs fine on 16-bit machines, but it Xhasn't been tested very thoroughly on them lately. It will not Xperform quite as well with the more limited space. X X Machines with very old compilers can be a headache. There Xare some hooks in hhhh////nnnneeeewwwwssss....hhhh for doing without ``void'' and X``unsigned long'', two particular problem areas, but they have to Xbe arranged manually; bbbbuuuuiiiilllldddd does not know about them. X X X X X X X X X X - 6 - X X X X Some very old systems cannot do _s_e_t_u_i_d(_g_e_t_e_u_i_d()), which Xmakes it impossible for a daemon to make directories and get the Xownership right. We provide a small program, sssseeeettttnnnneeeewwwwssssiiiiddddssss, to run Xsetuid-root. RRRReeeellllaaaayyyynnnneeeewwwwssss knows about it and invokes it if X_s_e_t_u_i_d(_g_e_t_e_u_i_d()) fails; it then sets permissions correctly and Xre-invokes rrrreeeellllaaaayyyynnnneeeewwwwssss. The code is short enough to be read and Xunderstood in full, so that the suspicious system administrator Xcan be sure that this setuid-root program is not going to do Xsomething awful. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X ! echo 'conf/proto.sh': sed 's/^X//' >'conf/proto.sh' <<'!' X#! /bin/sh X# namexxx - purposexxx X X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()= X. ${NEWSCONFIG-/usr/lib/news/bin/config} X XPATH=$NEWSCTL/bin:$NEWSBIN/xxx:$NEWSBIN:$NEWSPATH ; export PATH Xumask $NEWSUMASK ! echo 'conf/doit.bin': sed 's/^X//' >'conf/doit.bin' <<'!' Xumask 002 Xset -x X: setting up for substitutions Xcat >nsubstitutions <<'!' X# master substitutions file X# X# where the programs live (see also NEWSCONFIG) XNEWSBIN /usr/lib/newsbin X# where the control files live XNEWSCTL /usr/lib/news X# where the articles live XNEWSARTS /usr/spool/news X# what PATH should be used for finding normal programs X# (things not in NEWSBIN, that is) XNEWSPATH /bin:/usr/bin X# the umask under which files should be created XNEWSUMASK 002 X# who to send mail to when there is trouble XNEWSMASTER usenet X# configuration file that lets shell files pick up all of this XNEWSCONFIG /usr/lib/news/bin/config X! Xif test -r substitutions && cmp -s nsubstitutions substitutions Xthen X rm nsubstitutions Xelse X mv nsubstitutions substitutions Xfi X: done X: building headers Xcd .. Xif test ! -d include Xthen X mkdir include include/sys Xfi Xcd h Xrm -f nnewshsed Xecho "/NOSTOREVAL.*qqq/s;^;/* ;" >>nnewshsed Xecho "/SMALLMEM.*qqq/s;^;/* ;" >>nnewshsed Xif test -f newshsed && cmp -s nnewshsed newshsed Xthen X rm -f nnewshsed Xelse X mv nnewshsed newshsed Xfi Xmake all || exit 1 Xcd ../hfake Xed - Makefile <<'!' X/NEEDED =/s~.*~NEEDED = ../include/stdlib.h~ Xw X! Xmake all || exit 1 X: done X: making substitutions... Xcd ../conf X: make substs not necessary, defaults used X: done X: making spacefor, queuelen, etc.... Xrm -f spacefor queuelen hostname setnewsids Xmake spacefor.bsd Xcp spacefor.bsd spacefor Xmake queuelen.hdb Xcp queuelen.hdb queuelen X# ( echo '#! /bin/sh' ; echo 'echo utzoo' ) >hostname X: done X: making library... Xtouch ../ranlibed Xsleep 2 Xfor dir in libbsd42 libbig libc libcnews libstdio Xdo X cd ../$dir X make u || exit 1 Xdone Xcd ../libfake Xed - Makefile <<'!' X/NEEDED =/s/.*/NEEDED = ldiv.o/ Xw X! Xmake u || exit 1 Xcd ../conf Xmake ../ranlibed X: library done X: testing libstdio Xcd ../libstdio Xmake trials || exit 1 X: done X: building programs Xcd ../conf Xfor dir in conf batch expire input relay misc rna Xdo X cd ../$dir X make all DBM=-ldbm Xdone X: done X: building prototype control files Xcd ../conf Xrm -f active allowed errlog history history.pag history.dir localgroups log mailname mailpaths organization postdefltdist postdefltgroup replyusepath server sys whoami Xcp config.proto config Xecho 'utzoo.uucp' >mailname Xcat <<'!' >organization XU of Toronto Zoology X! Xecho 'henry' >allowed Xecho 'replies must use ! addresses' >replyusepath Xecho 'utzoo' >whoami Xecho 'general 00000 00000 y' >active Xecho 'news.announce.newusers 00000 00000 y' >>active X>errlog X>history X>history.pag X>history.dir Xecho 'general general local news' >localgroups X>log Xecho 'all uunet!%s' >mailpaths Xcp sys.proto sys Xcat >cron <<'!' X15 * 1-31 * 0-6 su news -c '/usr/lib/newsbin/input/newsrun' X30 8 1-31 * 1-5 su news -c '/usr/lib/newsbin/input/newsrunning off' X00 17 1-31 * 1-5 su news -c '/usr/lib/newsbin/input/newsrunning on' X40 * 1-31 * 0-6 su news -c '/usr/lib/newsbin/batch/sendbatches' X59 0 1-31 * 0-6 su news -c '/usr/lib/newsbin/expire/doexpire' X45 3 1-31 * 0-6 su news -c '/usr/lib/newsbin/expire/superkludge comp.mail.maps' X10 8 1-31 * 0-6 su news -c '/usr/lib/newsbin/maint/newsdaily' X00 5,13,21 1-31 * 0-6 su news -c '/usr/lib/newsbin/maint/newswatch' X! Xecho 'su news -c /usr/lib/newsbin/maint/newsboot' >rc X: done Xexit X: installing programs Xfor dir in conf batch expire input relay misc rna Xdo X cd ../$dir X make bininstall BIN=/bin RBIN=/usr/lib/uucp/bin DBM=-ldbm Xdone X: done X: installing manual pages Xcd ../man Xcp inews.1 /usr/man/man1/inews.1 Xcp postnews.1 /usr/man/man1/postnews.1 Xcp news.5 /usr/man/man5/news.5 Xcp expire.8 /usr/man/man8/expire.8 Xcp newsaux.8 /usr/man/man8/newsaux.8 Xcp newsbatch.8 /usr/man/man8/newsbatch.8 Xcp newsmail.8 /usr/man/man8/newsmail.8 Xcp relaynews.8 /usr/man/man8/relaynews.8 Xcp rnews.8 /usr/man/man8/rnews.8 X: done ! echo 'conf/Makefile': sed 's/^X//' >'conf/Makefile' <<'!' X# =()<NEWSARTS = @<NEWSARTS>@>()= XNEWSARTS = /usr/spool/news X# =()<NEWSBIN = @<NEWSBIN>@>()= XNEWSBIN = /usr/lib/newsbin X# =()<NEWSCTL = @<NEWSCTL>@>()= XNEWSCTL = /usr/lib/news X# workaround for System V make bug XSHELL = /bin/sh XNEWSUSER=news XNEWSGROUP=news XCOPTS = -O XCFLAGS = $(COPTS) -I../include '-DNEWSUSER="$(NEWSUSER)"' '-DNEWSGROUP="$(NEWSGROUP)"' XLIBS = ../libcnews.a XLIBDIRS = libbig libbsd42 libc libcnews libfake \ X libsmall libstdio libusg libv7 libv8 XDIRS = batch conf expire h hfake input $(LIBDIRS) misc relay rna X XPGMS = spacefor queuelen X Xall: $(PGMS) X Xbininstall: $(PGMS) X chmod +x $(PGMS) X cp $(PGMS) $(NEWSBIN) X -if test -r hostname ; then chmod +x hostname ; cp hostname $(NEWSBIN) ; fi X : and build takes care of setnewsids if needed X Xnewsinstall: X : build stuff does the real work X Xsubsts: subst.hs subst.gc substitutions subst X chmod +x subst X : too late for h and hfake, include has already been built X -egrep '^(h|hfake)/' subst.hs subst.gc >junk X test ! -s junk X rm -f junk X ./subst -f substitutions `sed 's;^;../;' subst.hs subst.gc` X Xspacefors: spacefor.sysv spacefor.v7 spacefor.sgi spacefor.bsd spacefor.null X Xspacefor.bsd: spacefor.proto Makefile X cp spacefor.proto $@ X Xspacefor.v7: spacefor.proto Makefile X sed '/dfunit=/s/1024/512/;/nr = 2/s//nr = 1/;/nf = 4/s//nf = 2/;/stupid/d' spacefor.proto >$@ X Xspacefor.sysv: spacefor.proto Makefile X sed '/dfunit=/s/1024/512/;/awk/s~|~| sed "s/.*:/: :/" |~;/nf = 4/s//nf = 3/;/stupid/s/4BSD/System V/' spacefor.proto >$@ X Xspacefor.sgi: spacefor.proto Makefile X sed '/dfunit=/s/1024/512/;/nf = 4/s//nf = 5/;/stupid/s/4BSD/SGI/' spacefor.proto >$@ X Xspacefor.null: Makefile X echo '#! /bin/sh' >$@ X echo 'echo 100' >>$@ X Xqueuelen.hdb: X : okay X Xqueuelen.sub: X : okay X Xqueuelen.null: X echo '#! /bin/sh' >$@ X echo 'echo 0' >>$@ X Xsetnewsids: setnewsids.o $(LIBS) X $(CC) $(CFLAGS) setnewsids.o $(LIBS) -o $@ X X../ranlibed: ../libcnews.a X ranlib ../libcnews.a X touch ../ranlibed X Xclean: X rm -f spacefor.sysv spacefor.v7 spacefor.null queuelen.null X rm -f spacefor.sgi X rm -f allowed config mailname organization server whoami hostname errlog X rm -f substitutions history history.pag history.dir active localgroups X rm -f log mailpaths sys cron rc setnewsids setnewsids.o spacefor.bsd X rm -f replyusepath spacefor queuelen junk X Xgclean: tidy X rm -f ../libcnews.a ../ranlibed X rm -rf ../include X Xtidy: X for d in $(DIRS) ; do cd ../$$d ; make clean ; done X Xspotless: gclean X rm -f again.root doit.bin doit.news doit.root X Xlclean: X rm -f ../ranlibed X for d in $(LIBDIRS) ; do cd ../$$d ; make clean ; done ! echo 'conf/subst': sed 's/^X//' >'conf/subst' <<'!' X#! /bin/sh X# subst - substitute strings into files, carefully X XPATH=/bin:/usr/bin ; export PATH X Xcase "$1" Xin X -f) X substs=$2 X shift ; shift X ;; X X *) X echo "$0: no substitutions file given" >&2 X exit 2 X ;; Xesac X Xthem="`sed '/^#/d; s/^\\([^ ]*\\) *\\([^ ]*\\)$/s#@<\\1>@#\\2#g/' $substs`" X Xfor f Xdo X # first, figure out temporary names X case "$f" X in X */*) X file="`expr \"$f\" : '.*/\\([^/]*\\)'`" X dir="`expr \"$f\" : '\\(.*\\)/[^/]*'`" X new="$dir/n.$file" X old="$dir/o.$file" X ;; X X *) X new="n.$f" X old="o.$f" X ;; X esac X echo "$f:" X X # test existences X if test ! -f $f X then X echo "$0: cannot find \`$f'" >&2 X continue # NOTE CONTINUE X fi X if test -r $new X then X echo "$0: $new exists, cannot proceed" >&2 X exit 1 X fi X if test -r $old X then X echo "$0: $old exists, cannot proceed" >&2 X exit 1 X fi X ( >$old >$new ) 2>/dev/null X if test ! -w "$old" -o ! -w "$new" X then X rm -f $old $new X echo "$0: cannot create temporaries $old $new" >&2 X exit 1 X fi X X # generate the new version X trap "rm -f $new; exit" 1 2 15 X sed "/=()<.*>()=/{ X h X n X g X s/.*=()<// X s/>()=.*// X $them X }" $f >$new X X # substitute new for old X trap "mv $old $f; exit" 1 2 15 X mv $f $old X mv $new $f X X # dispense with the old version X trap "rm -f $old; exit" 1 2 15 X rm $old Xdone ! echo 'conf/README': sed 's/^X//' >'conf/README' <<'!' XThis is C News master configuration stuff, including some auxiliary C News Xprograms that are quite likely to need site-specific customizing, and some Xodds and ends of maintenance stuff that didn't fit anywhere else. X XSubst may possibly be useful enough to deserve installation as a program Xin its own right, which is why a manual page is supplied. X X"build" is the all-singing-all-dancing interactive shell program that sets Xup a bunch of shell files for you to run to install everything. "build" Xitself does not mess with anything, so it can be run without danger. X Xbuild shell program to build shell files to build and install news Xconfig.proto prototype configuration file for use by build Xnewslock.sh template for how to do locking in shell files Xproto.sh template for how to write a C News shell file Xquery minor auxiliary to build Xqueuelen.hdb Xqueuelen.sub versions of queuelen for different uucps Xspacefor.bsd 4.2BSD spacefor; Makefile knows how to build others from it Xsubst substituter program used by build to configure C News Xsubst.1 manpage for subst Xsubst.gc Xsubst.hs lists of files needing attention by subst Xsys.proto prototype sys file for use by build ! echo 'conf/subst.hs': sed 's/^X//' >'conf/subst.hs' <<'!' Xbatch/Makefile Xbatch/batchsplit Xbatch/compb Xbatch/compc7 Xbatch/sendbatches Xconf/Makefile Xconf/config.proto Xconf/proto.sh Xconf/queuelen.hdb Xconf/queuelen.sub Xconf/spacefor.proto Xexpire/Makefile Xexpire/doexpire Xexpire/mkhistory Xexpire/superkludge Xexpire/upact Xinput/Makefile Xinput/newsrun Xinput/newsrunning Xinput/recenews Xinput/recpnews Xinput/rnews.batch Xlibc/standard.c Xlibcnews/config.c Xman/expire.8 Xman/inews.1 Xman/news.5 Xman/newsaux.8 Xman/newsbatch.8 Xman/newsmail.8 Xman/relaynews.8 Xman/rnews.8 Xmisc/Makefile Xmisc/newsboot Xmisc/newsdaily Xmisc/newshostname Xmisc/newswatch Xman/postnews.1 Xmisc/addgroup Xmisc/delgroup Xmisc/locknews Xnotebook/config Xbatch/batchih ! echo 'conf/subst.gc': sed 's/^X//' >'conf/subst.gc' <<'!' Xrelay/altctl/checkgroups.new Xrelay/altctl/rmgroup.auto Xrelay/aux/chamod Xrelay/aux/mailnews Xrelay/aux/mkpdir Xrelay/aux/newsreply Xrelay/ctl/checkgroups Xrelay/ctl/newgroup Xrelay/ctl/rmgroup Xrelay/ctl/sendsys Xrelay/ctl/senduuname Xrelay/ctl/version Xrelay/makefile Xrelay/sh/anne.jones Xrelay/sh/ctlrun Xrelay/sh/inews Xrna/makefile Xrelay/sh/postnews ! echo 'conf/sys.proto': sed 's/^X//' >'conf/sys.proto' <<'!' X# line indicating what we are willing to receive; note local groups on end XME:comp,news,sci,rec,misc,soc,talk,to,can,ont,tor,ut X X# sample insignificant feed not using batching Xhuey:news.config,to.huey/all::uux - -r -gd huey!rnews X X# sample major batched feed, including (unnecessary) explicit file name Xdewey:comp,news,sci,rec,misc,soc,talk,to.dewey,can,ont,tor,ut/all:f:dewey/togo X X# sample long-haul feed; note no local groups Xdonald:comp,news,sci,rec,misc,soc,talk,to.donald/all:f: X X# sample local-postings-only feed direct to major site (gets them out fast) Xscrooge:comp,news,sci,rec,misc,soc,talk,to.scrooge/all:Lf: X X# sample ihave/sendme link X# Send ihave telling louie what we have -- batcher turns the batch into a X# giant control message and posts it to "to.louie". (#1) Xlouie:rec.music.synth/all,!sendme,!ihave:I:louie.ihave/togo X# Send sendme in response to ihave from louie -- again, turned by batcher X# into giant control message posted to "to.louie". (#3) Xlouie-send-ids:to.louie/ihave:I:louie.sendme/togo X# Transmit said giant control messages by normal batching. (#2,#4) Xlouie-ctl:to.louie/all,!sendme,!ihave:f:louie/togo X# Send articles in response to sendme messages from louie. (#5) Xlouie-real:to.louie/sendme:f:louie/togo X# Actually the last two could be combined. ! echo 'conf/queuelen.sub': sed 's/^X//' >'conf/queuelen.sub' <<'!' X#! /bin/sh X# Find size of current queue of news outbound to $1. Old-uucp version. X X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()= X. ${NEWSCONFIG-/usr/lib/news/bin/config} X XPATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH Xumask $NEWSUMASK X Xcd /usr/spool/uucp Xgrade=d X Xcase "$1" in X?|??|???|????|?????|??????|???????) site="$1" ;; X*) site=`expr "$1" : '^\(.......\).*'` Xesac X Xif test -d C. Xthen X cd C. X ls | egrep "^C\.$site$grade....\$" | wc | awk '{print $1}' Xelse X echo 0 Xfi ! echo 'conf/query': sed 's/^X//' >'conf/query' <<'!' X#! /bin/sh Xecho "$*" | tr -d '\012' # echo -n, more or less portably ! echo 'conf/subst.1': sed 's/^X//' >'conf/subst.1' <<'!' X.TH SUBST 1 local X.DA 21 Feb 1989 X.SH NAME Xsubst \- substitute definitions into file(s) X.SH SYNOPSIS X.B subst X.B \-f Xsubstitutions Xvictim ... X.SH DESCRIPTION X.I Subst Xmakes substitutions into files, in a way that is suitable for customizing Xsoftware to local conditions. XEach X.I victim Xfile Xis altered according to the contents of Xthe X.I substitutions Xfile. X.PP XThe X.I substitutions Xfile contains one line per substitution. XA line consists of two fields separated by one or more tabs. XThe first field is the \fIname\fR of the substitution, the second Xis the \fIvalue\fR. XNeither should contain the character `#'. XA line starting with `#' is a comment and is ignored. X.PP XIn the \fIvictim\fRs, Xeach line on which a substitution is to be made X(a \fItarget\fR line) Xmust be preceded by a X\fIprototype\fR line. XThe prototype line should be delimited in such a way that it will be Xtaken as a comment by whatever program processes the file later. XThe prototype line must contain a ``prototype'' of the target line bracketed Xby `=()<' and `>()='; Xeverything else on the prototype line is ignored. X.I Subst Xextracts the prototype, changes all instances of substitution names Xbracketed by `@<' and `>@' to their values, Xand then replaces the target line with the result. X.SH EXAMPLE X.PP XIf the \fIsubstitutions\fR file is X.PP X.RS X.nf X.ta \w'SECOND'u+4n XFIRST 111 XSECOND 222 X.fi X.RE X.PP Xand the \fIvictim\fR file is X.PP X.RS X.nf Xx = 2; X/* =()<y = @<FIRST>@ + @<SECOND>@;>()= */ Xy = 88 + 99; Xz = 5; X.fi X.RE X.PP Xthen ``\fBsubst \-f \fIsubstitutions victim\fR'' changes \fIvictim\fR to: X.PP X.RS X.nf Xx = 2; X/* =()<y = @<FIRST>@ + @<SECOND>@;>()= */ Xy = 111 + 222; Xz = 5; X.fi X.RE X.SH FILES X.ta \w'n.\fIvictim\fR'u+4n Xn.\fIvictim\fR new version being built X.br Xo.\fIvictim\fR old version during renaming X.SH SEE ALSO Xsed(1) X.SH DIAGNOSTICS XComplains and halts if it is unable to create its temporary files Xor if they already exist. X.SH HISTORY XWritten at U of Toronto by Henry Spencer. X.SH BUGS XWhen creating a file to be \fIsubst\fRed, it's easy to forget to insert Xa dummy target line after a prototype line; Xif you forget, \fIsubst\fR ends up deleting whichever line did in fact Xfollow the prototype line. ! echo 'conf/doit.root': sed 's/^X//' >'conf/doit.root' <<'!' Xumask 002 Xset -x X: making directories... Xfor d in /usr/spool/news /usr/spool/news/in.coming /usr/spool/news/in.coming/bad /usr/spool/news/out.going /usr/lib/news /usr/lib/news/bin /usr/lib/newsbin Xdo X if test ! -d $d X then X mkdir $d X fi Xdone X/etc/chown news.news /usr/spool/news /usr/spool/news/in.coming /usr/spool/news/in.coming/bad /usr/spool/news/out.going /usr/lib/news /usr/lib/news/bin X/etc/chown bin.bin /usr/lib/newsbin X: done ! echo 'conf/doit.news': sed 's/^X//' >'conf/doit.news' <<'!' Xumask 002 Xset -x X: installing programs Xfor dir in conf batch expire input relay misc rna Xdo X cd ../$dir X make newsinstall BIN=/bin RBIN=/usr/lib/uucp/bin DBM=-ldbm Xdone X: done X: installing control files Xcd ../conf Xfor f in active allowed errlog history history.pag history.dir localgroups log mailname mailpaths organization postdefltdist postdefltgroup replyusepath server sys whoami Xdo X if test -r /usr/lib/news/$f X then X echo "/usr/lib/news/$f already exists; left unchanged" X elif test ! -r $f X then X : "$f" not wanted X else X cp $f /usr/lib/news/$f X fi Xdone Xif test -r /usr/lib/news/bin/config Xthen X echo '/usr/lib/news/bin/config already exists; left unchanged' Xelse X cp config /usr/lib/news/bin/config X chmod +x /usr/lib/news/bin/config Xfi X: It is virtually certain that some of those control files X: need modifying to suit your system. In particular, you X: should pick up a current 'active' file from your neighbors. X: done ! echo 'conf/again.root': sed 's/^X//' >'conf/again.root' <<'!' Xumask 002 Xset -x X: setting uids for setuid programs... X/etc/chown news.news /usr/lib/newsbin/input/newsspool /usr/lib/newsbin/relay/relaynews Xchmod u+s,g+s /usr/lib/newsbin/input/newsspool /usr/lib/newsbin/relay/relaynews X: done ! echo 'conf/queuelen.hdb': sed 's/^X//' >'conf/queuelen.hdb' <<'!' X#! /bin/sh X# Find size of current queue of news outbound to $1. HDB/BNU version. X X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()= X. ${NEWSCONFIG-/usr/lib/news/bin/config} X XPATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH Xumask $NEWSUMASK X Xcd /usr/spool/uucp Xgrade=d X Xif test -d $1 Xthen X cd $1 X ls | egrep "^C\..*$grade....\$" | wc | awk '{print $1}' Xelse X echo 0 Xfi ! echo 'conf/newslock.sh': sed 's/^X//' >'conf/newslock.sh' <<'!' Xlock="$NEWSCTL/LOCKxxx" # modify name as appropriate Xltemp="$NEWSCTL/L.$$" Xecho $$ >$ltemp Xtrap "rm -f $ltemp ; exit 0" 0 1 2 15 Xwhile true Xdo X if newslock $ltemp $lock X then X trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15 X break X fi X sleep 30 Xdone ! echo 'conf/config.proto': sed 's/^X//' >'conf/config.proto' <<'!' X# configuration -- all the shell files pick this up using "." X# this makes it possible to add new variables here and have them X# available everywhere immediately X# X# =()<NEWSCTL=${NEWSCTL-@<NEWSCTL>@}>()= XNEWSCTL=${NEWSCTL-/usr/lib/news} X# =()<NEWSBIN=${NEWSBIN-@<NEWSBIN>@}>()= XNEWSBIN=${NEWSBIN-/usr/lib/newsbin} X# =()<NEWSARTS=${NEWSARTS-@<NEWSARTS>@}>()= XNEWSARTS=${NEWSARTS-/usr/spool/news} X# =()<NEWSPATH=${NEWSPATH-@<NEWSPATH>@}>()= XNEWSPATH=${NEWSPATH-/bin:/usr/bin} X# =()<NEWSUMASK=${NEWSUMASK-@<NEWSUMASK>@}>()= XNEWSUMASK=${NEWSUMASK-002} X# =()<NEWSMASTER=${NEWSMASTER-@<NEWSMASTER>@}>()= XNEWSMASTER=${NEWSMASTER-usenet} X# =()<NEWSCONFIG=${NEWSCONFIG-@<NEWSCONFIG>@}>()= XNEWSCONFIG=${NEWSCONFIG-/usr/lib/news/bin/config} ! echo done -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.