Subject: Re: man links: hard/symbolic
To: None <>
From: Greg A. Woods <>
List: tech-userlevel
Date: 04/23/1999 19:55:12
[ On Friday, April 23, 1999 at 18:33:14 (-0400), Todd Vierling wrote: ]
> Subject: Re: man links: hard/symbolic
> I'm talking about files shipped in the binary *sets*.  I can set symlinks if
> I build from source, but I'm not about to build from source on all the
> machines I administer.

Ah, so, you're talking only about the installed /usr/share/man/cat?/*
files and how to turn them into a binary tar set with containing
compressed files.

Ummm, but if you build the prototype machine with compressed cattable
manual pages in the first place (i.e. with MANZ defined in /etc/mk.conf)
then what happens?  Isn't there already automagic sed'ing of the
distrib/sets/lists/man/* files, just as there is for pkgsrc?  Don't the
links come along "for free" just because that's the way the files have
been installed?

Hmmm.  Maybe not.

I don't know exactly how the full binary release building works in
NetBSD yet (I'm glad to finally see "make release" in the top-level
makefile, and hopefully "make release" takes on the job of doing build
in distrib/$ARCH soon too -- FreeBSD easily beats NetBSD by a country
mile in this department) but I suspect the responsibility for
dynamically handling compressed cattable manual pages would be hidden in
distrib/sets/maketars, but that script doesn't yet seem to have an
option for handling the case where the build was done with MANZ defined.

I'd say that this a bug.

> : Wouldn't it be best to do so anyway even if you used symlinks,
> : because if you try to do the compression afterwards you still have to
> : search out and update all the symlinks (about the same difficulty as
> : renaming all hard-links, I'd say)
> Doing that for hard-links from a binary set is more difficult than renaming
> the targets and names of symlinks.  Symlinks need only a little awk magic
> whereas matching up hard links is much more difficult.

With hard links all you should need to do is change the name of the file
specified in distrib/sets/lists/man/*, as the links are already made,
with the appropriate compress suffix.

Of course if you're trying to construct a binary set that'll contain
compressed manual pages from a prototype system that was built without
compressing the cattable manual pages during installation then you will
indeed have to do a bit more work, but only to ensure that you don't
break any existing links or re-compress any already compressed files
when you're going about compressing the already installed files:

	find /usr/share/man/cat? -type f -print | while read catfile ; do
		# definition of "iscompressed" is left as an excercise
		# to the reader!  ;-)
		if iscompressed $catfile ; then
			mv $catfile ${catfile}.gz
			gzip $catfile > /tmp/foo$$
			cat /tmp/foo$$ > $catfile && rm /tmp/foo$$
			mv $catfile ${catfile}.gz

However I think it's best to just install compressed manual pages in the
first place, and fix maketars to "do the right thing" if MANZ is
defined, and then build your sets with "cd /etc; make release" to create
the tar sets (or whatever's correct for NetBSD these days).
							Greg A. Woods

+1 416 218-0098      VE3TCP      <>      <robohack!woods>
Planix, Inc. <>; Secrets of the Weird <>