Subject: Re: quick build.sh question
To: NetBSD current-users <current-users@netbsd.org>
From: BOUWSMA Beery <netbsd-user@ipv6.netscum.dyndns.dk>
List: current-users
Date: 06/08/2002 07:34:06
[This is an IPv6-only e-mail address, if you have any need to
 respond to this and send me a copy but do not have IPv6-
 capability, strip out the obvious part of the address, but I
 follow the list archives so no need to mail me]


Yay!  I just got through my first build of -current since 07.Feb,
and noted a few new things, like, say, this here:

> > ...then etcupdate
> > ...then usr/src/etc/postinstall

> Why is it necessary to run both etcupdate and /usr/src/etc/postinstall?
> (I thought they both did essentially the same thing. . . .)  Does it
> make any difference which is run first?  Why?

And lo, etc/postinstall at the end of the build process caught my
eye.  And yea verily, I did indeed run my own hacked version of
`mergemaster' to try to address most of the issues pointed to by
`postinstall' (out of familiarity), and noted something during the
run, and then later when reviewing the initial output of `postinstall'

It looks as if `postinstall' is in some ways a sanity check, perhaps
also extending what `etcupdate' is able or supposed to do.  At least,
I ran `postinstall' after my `mergemaster' based update, and I was
rather startled to see quite a few things that I had noticed in my
initial review of the output (like ``hey, I don't recall being asked
to update this file...'')

There seems to be a problem with CVS IDs in the repository in a few
files I updated, that cause `mergemaster' (hacked from FreeBSD) and
perhaps also `etcupdate' (which I vaguely recall being similar to
`mergemaster') to miss noticing that certain files have changed...

Here's the head of one file I noted when reviewing diffs:

bash-2.05a$ head /usr/src/etc/etc.i386/ttys 
#
#       from: @(#)ttys  5.1 (Berkeley) 4/17/89
#       $NetBSD$
#
        ^^^^^^^^

Um.  Hmmm.  I keep a copy of the CVS repository locally (maintained
via `cvsup'), and from this I `cvs update'd my local source.

All right, here's one of the files that `postinstall' complained
about, which `mergemaster' didn't notice:

bash-2.05a$ ls -l /usr/src/etc/rc.shutdown 
-rw-r--r--  1 beer  wheel  1503 Jun  5 09:37 /usr/src/etc/rc.shutdown
bash-2.05a$ head !$
head /usr/src/etc/rc.shutdown
#!/bin/sh
#
# $NetBSD: rc.shutdown,v 1.7 2001/11/19 03:19:28 lukem Exp $

Whilst if I do a `diff' against my installed version, well...

bash-2.05a$ ls -l /etc/rc.shutdown 
-rw-r--r--  1 root  wheel  1473 Jan  1 05:55 /etc/rc.shutdown
bash-2.05a$ diff -u !$  /usr/src/etc/rc.shutdown   
diff -u /etc/rc.shutdown  /usr/src/etc/rc.shutdown 
--- /etc/rc.shutdown    Tue Jan  1 05:55:33 2002
+++ /usr/src/etc/rc.shutdown    Wed Jun  5 09:37:14 2002
@@ -47,9 +47,9 @@
 #      Determine the shutdown order of the /etc/rc.d scripts,
 #      and perform the operation
 #
-files=`rcorder -k shutdown /etc/rc.d/*`
+files=$(rcorder -k shutdown ${rcshutdown_rcorder_flags} /etc/rc.d/*)
 
-for _rc_elem in `reverse_list $files`; do
+for _rc_elem in $(reverse_list $files); do
        run_rc_script $_rc_elem stop
 done
 
bash-2.05a$ head !:2
head /etc/rc.shutdown
#!/bin/sh
#
# $NetBSD: rc.shutdown,v 1.7 2001/11/19 03:19:28 lukem Exp $


Hang on, the version in the new file is the same as that in the
older file?  Aiee...

Looking through the CVS repository suggests to me that the new
file should be 1.8 and not 1.7...  Aieee.


Anyway, `mergemaster' decides whether or not to submit the files
for diffs based on the version, even when the files are different
(so local hacks stay intact when the version doesn't change).  So
I see a buncha files that have apparently changed without the
version number getting bumped...


[snip]
periodic check:
	//etc/security != /usr/src/etc/security
rc check:
	//etc/rc.shutdown != /usr/src/etc/rc.shutdown
	//etc/rc.d/LOGIN != /usr/src/etc/rc.d/LOGIN
	//etc/rc.d/SERVERS != /usr/src/etc/rc.d/SERVERS
	//etc/rc.d/accounting != /usr/src/etc/rc.d/accounting
	//etc/rc.d/altqd != /usr/src/etc/rc.d/altqd
	//etc/rc.d/apmd != /usr/src/etc/rc.d/apmd
	//etc/rc.d/bootparams != /usr/src/etc/rc.d/bootparams
	//etc/rc.d/cleartmp != /usr/src/etc/rc.d/cleartmp
	//etc/rc.d/dhclient != /usr/src/etc/rc.d/dhclient
	//etc/rc.d/dhcpd != /usr/src/etc/rc.d/dhcpd
	//etc/rc.d/dhcrelay != /usr/src/etc/rc.d/dhcrelay
	//etc/rc.d/downinterfaces != /usr/src/etc/rc.d/downinterfaces
	//etc/rc.d/ipnat != /usr/src/etc/rc.d/ipnat
	//etc/rc.d/ipsec != /usr/src/etc/rc.d/ipsec
	//etc/rc.d/ldconfig != /usr/src/etc/rc.d/ldconfig
	//etc/rc.d/lkm3 != /usr/src/etc/rc.d/lkm3
	//etc/rc.d/local != /usr/src/etc/rc.d/local
	//etc/rc.d/lpd != /usr/src/etc/rc.d/lpd
	//etc/rc.d/mopd != /usr/src/etc/rc.d/mopd
	//etc/rc.d/motd != /usr/src/etc/rc.d/motd
	//etc/rc.d/mountall != /usr/src/etc/rc.d/mountall
	//etc/rc.d/mrouted != /usr/src/etc/rc.d/mrouted
	//etc/rc.d/postfix != /usr/src/etc/rc.d/postfix
	//etc/rc.d/ppp != /usr/src/etc/rc.d/ppp
	//etc/rc.d/pwcheck != /usr/src/etc/rc.d/pwcheck
	//etc/rc.d/quota != /usr/src/etc/rc.d/quota
	//etc/rc.d/racoon != /usr/src/etc/rc.d/racoon
	//etc/rc.d/rarpd != /usr/src/etc/rc.d/rarpd
	//etc/rc.d/rbootd != /usr/src/etc/rc.d/rbootd
	//etc/rc.d/route6d != /usr/src/etc/rc.d/route6d
	//etc/rc.d/routed != /usr/src/etc/rc.d/routed
	//etc/rc.d/rtadvd != /usr/src/etc/rc.d/rtadvd
	//etc/rc.d/rtsold != /usr/src/etc/rc.d/rtsold
	//etc/rc.d/rwho != /usr/src/etc/rc.d/rwho
	//etc/rc.d/screenblank != /usr/src/etc/rc.d/screenblank
	//etc/rc.d/sendmail != /usr/src/etc/rc.d/sendmail
	//etc/rc.d/swap2 != /usr/src/etc/rc.d/swap2
	//etc/rc.d/sysdb != /usr/src/etc/rc.d/sysdb
	//etc/rc.d/timed != /usr/src/etc/rc.d/timed
	//etc/rc.d/ttys != /usr/src/etc/rc.d/ttys
	//etc/rc.d/virecover != /usr/src/etc/rc.d/virecover
	//etc/rc.d/xfs != /usr/src/etc/rc.d/xfs
	//etc/rc.d/ypbind != /usr/src/etc/rc.d/ypbind
	//etc/rc.d/yppasswdd != /usr/src/etc/rc.d/yppasswdd
[...]

The few of these that I looked at still had the old CVS version
number in both my old file and the new one just updated...
As taken from etc/security,v in CVS --

1.75
date    2002.05.21.13.50.46;    author lukem;   state Exp;
branches;
next    1.74;

1.74
date    2001.12.18.00.44.20;    author lukem;   state Exp;
[...]
1.75
log
@Support shell metacharacters (`*', '?', '[') in /etc/changelist lines,
including checks for "backups that exist when actual file is deleted", a la
the existing mechanism used for "/etc/ifconfig.*" ... "/etc/rc.d/*" checks.
This resolves [security/15798] from Bob Kemp <bob@@allegory.demon.co.uk>.
@
text
@#!/bin/sh -
#
#       $NetBSD: security,v 1.74 2001/12/18 00:44:20 lukem Exp $
#       from: @@(#)security     8.1 (Berkeley) 6/9/93

[...]
bash-2.05a$ ls -l !$
ls -l /mnt/cvsup/NetBSD.cvs/basesrc/etc/security,v
-r--r--r--  1 beer  drunkards  100510 May 22 03:33 /mnt/cvsup/NetBSD.cvs/basesrc/etc/security,v


Is my copy of this file somehow not the same as that in the master
repository?

(I did get a good number of files with changed IDs, so it looks as if
some files, like most of the ones mentioned above, are fscked if they
are identical in my local copy of the repository)


I have to agree, postinstall looks very kewl, complementing whatever
else one might use...

	Remove obsolete //etc/rc.d/NETWORK
	Remove obsolete //etc/rc.d/gated
	Obsolete rc.conf(5) variable '$critical_filesystems_beforenet' found.
	Obsolete rc.conf(5) variable '$critical_filesystems' found.
ssh check:
	Move //etc/ssh_host_dsa_key to //etc/ssh/ssh_host_dsa_key
[...]


However, it doesn't seem to look at everything (for example, the
/etc/ttys file that I had to merge my own local changes to, when
I noticed the lack of version number in the CVS ID, was never
mentioned by `postinstall' -- if I had to play with other files
that were similarly messed up, I wasn't paying attention).  Also,
MAKEDEV isn't mentioned, so you apparently need to run both, and
use `postinstall' as a check after each `etcupdate' or whatever
other change you need to do...


Of course, I could be wrong.


And of course, I'm scared of rebooting now, what with the changes
I'm supposed to make, but haven't...

thanks
barry bouwsma