etc/postinstall

*	Improve message display in find_file_in_dirlist()
    *	do_obsolete(): instead of running distrib/sets/makeobsolete to
	temporarily generate the obsolete sets lists, look for them in
	${SRC_DIR}/etc/obsolete/* or ${DEST_DIR}/etc/obsolete/*.
	The obsolete check now works for "extracted etc.tgz" as the source dir.

etc/Makefile (install-etc-files), distrib/sets/lists/*
    *	Install obsolete set lists into /etc/obsolete/
    *	Tweak how pwd_mkdb files are added to METALOG

distrib/sets/makeobsolete
    *	Don't bother with "_obsolete" suffix on generated file names.
This commit is contained in:
lukem 2003-02-20 11:40:28 +00:00
parent d1d5ade4cf
commit 5c198ab018
6 changed files with 42 additions and 31 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.381 2003/02/18 20:35:28 jdolecek Exp $
# $NetBSD: mi,v 1.382 2003/02/20 11:40:30 lukem Exp $
. base-sys-root
./altroot base-sys-root
./bin base-sys-root
@ -51,6 +51,7 @@
./etc/mail base-sendmail-root
./etc/mtree base-sys-root
./etc/namedb base-bind-root
./etc/obsolete base-sys-root
./etc/openssl base-crypto-root
./etc/openssl/certs base-crypto-root
./etc/openssl/misc base-crypto-root

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.113 2003/01/16 11:55:28 martti Exp $
# $NetBSD: mi,v 1.114 2003/02/20 11:40:30 lukem Exp $
./.cshrc etc-util-etc
./.profile etc-util-etc
./dev/MAKEDEV etc-sys-etc
@ -54,6 +54,13 @@
./etc/newsyslog.conf etc-sysutil-etc
./etc/nsswitch.conf etc-net-etc
./etc/ntp.conf etc-ntp-etc
./etc/obsolete/base etc-sys-etc
./etc/obsolete/comp etc-sys-etc
./etc/obsolete/etc etc-sys-etc
./etc/obsolete/games etc-sys-etc
./etc/obsolete/man etc-sys-etc
./etc/obsolete/misc etc-sys-etc
./etc/obsolete/text etc-sys-etc
./etc/passwd etc-sys-etc
./etc/passwd.conf etc-sys-etc
./etc/phones etc-uucp-etc

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: makeobsolete,v 1.16 2002/11/26 06:22:23 lukem Exp $
# $NetBSD: makeobsolete,v 1.17 2003/02/20 11:40:29 lukem Exp $
#
# Print out the obsolete files for a set
# Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
@ -86,7 +86,7 @@ lists=$_lists
unset _lists
for setname in $lists; do
file=$target/${setname}_obsolete
file=$target/${setname}
(
if [ -f $setd/lists/$setname/obsolete.mi ]; then
awk -- '{print $1}' $setd/lists/$setname/obsolete.mi

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.245 2003/02/16 00:22:37 lukem Exp $
# $NetBSD: Makefile,v 1.246 2003/02/20 11:40:28 lukem Exp $
# from: @(#)Makefile 8.7 (Berkeley) 5/25/95
# Environment variables without default values:
@ -134,6 +134,8 @@ TARGET_ENDIANNESS= -B
TARGET_ENDIANNESS=
.endif
.endif # install-etc-files # }
OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
OBSOLETE.files= base comp etc games man misc text
# distribution --
@ -171,9 +173,9 @@ install-etc-files: check_DESTDIR
${DESTDIR}/etc/master.passwd
.if defined(UNPRIVED)
( \
echo "./etc/passwd type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel tags=etc_pkg"; \
for metaent in passwd pwd.db spwd.db; do \
echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
done; \
) | ${METALOG.add}
.endif # UNPRIVED
${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
@ -279,6 +281,12 @@ install-etc-files: check_DESTDIR
.if !defined(NO_SENDMAIL) || ${NO_SENDMAIL} == "no"
(cd ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
.endif
mkdir -p ${OBSOLETE.dir}
(cd ${NETBSDSRCDIR}/distrib/sets; sh ./makeobsolete -t ${OBSOLETE.dir})
.for file in ${OBSOLETE.files}
${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
${OBSOLETE.dir}/${file} ${DESTDIR}/etc/obsolete
.endfor
# distrib-dirs --
@ -503,6 +511,6 @@ snap_md_post: check_DESTDIR check_RELEASEDIR
clean:
-rm -rf ${CDROM.dir} ${CDROM.pathlist}
-rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: NetBSD.dist,v 1.215 2003/02/16 00:19:00 lukem Exp $
# $NetBSD: NetBSD.dist,v 1.216 2003/02/20 11:40:29 lukem Exp $
# @(#)4.4BSD.dist 8.1 (Berkeley) 6/13/93
/set type=dir uname=root gname=wheel mode=0755
@ -17,6 +17,7 @@
./etc/mail
./etc/mtree
./etc/namedb
./etc/obsolete
./etc/openssl
./etc/openssl/certs
./etc/openssl/misc

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: postinstall,v 1.50 2003/02/18 10:12:52 lukem Exp $
# $NetBSD: postinstall,v 1.51 2003/02/20 11:40:28 lukem Exp $
#
# Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
# All rights reserved.
@ -41,12 +41,6 @@
# over time as NetBSD evolves.
#
# bugs:
# - may need MACHINE_ARCH set.
# - need MAKE set (c.f, uwe@)
# - makeobsolete needs copy of obsolete files, or better way to
# generate them
#
# checks to add:
# - obsolete minor/teeny shared libraries in /lib
@ -267,15 +261,19 @@ rcconf_is_set()
)
}
# find_file_in_dirlist() file dir1 [...] --
# find_file_in_dirlist() file message dir1 [...] --
# find which directory file is in, and sets ${dir} to match
# returns 0 if matched, otherwise 1 (and sets ${dir} to "").
#
# generally, check the directory for the "checking from source" case,
# and then the directory for the "checking from extracted etc.tgz" case.
#
find_file_in_dirlist()
{
[ $# -ge 2 ] || err 2 "USAGE: find_file_in_dirlist file dir1 [...]"
[ $# -ge 3 ] || err 2 "USAGE: find_file_in_dirlist file msg dir1 [...]"
_file=$1 ; shift
_msg=$1 ; shift
_dir1st=
for dir in $*; do
: ${_dir1st:=${dir}}
@ -287,7 +285,7 @@ find_file_in_dirlist()
return 0
fi
done
msg "Can't find source directory"
msg "Can't find source directory for ${_msg}"
return 1
}
@ -587,7 +585,7 @@ do_makedev()
{
[ -n "$1" ] || err 2 "USAGE: do_makedev fix|check"
find_file_in_dirlist MAKEDEV \
find_file_in_dirlist MAKEDEV "MAKEDEV" \
${SRC_DIR}/etc/etc.${MACHINE} ${SRC_DIR}/dev \
|| return 1
@ -604,7 +602,7 @@ do_postfix()
op=$1
failed=0
find_file_in_dirlist postfix-script \
find_file_in_dirlist postfix-script "postfix scripts" \
${SRC_DIR}/gnu/dist/postfix/conf \
${DEST_DIR}/usr/share/examples/postfix \
|| return 1
@ -627,17 +625,13 @@ do_obsolete()
[ -n "$1" ] || err 2 "USAGE: do_obsolete fix|check"
op=$1
setdir=${SRC_DIR}/distrib/sets
makeobs=${setdir}/makeobsolete
if [ ! -x "${makeobs}" ]; then
warn "Can't find program \"${makeobs}\""
return 1
fi
( cd ${setdir} && ./makeobsolete -s . -t ${SCRATCHDIR} )
failed=0
for obssrcfile in ${SCRATCHDIR}/*_obsolete; do
find_file_in_dirlist base "obsolete set lists" \
${SRC_DIR}/etc/obsolete ${DEST_DIR}/etc/obsolete \
|| return 1
for obssrcfile in ${dir}/*; do
while read ofile; do
ofile=${DEST_DIR}${ofile#.}
cmd="rm"