Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/postinstall /etc/defaults/rc.conf can be modified a...



details:   https://anonhg.NetBSD.org/src/rev/4d4651d7d89f
branches:  trunk
changeset: 769358:4d4651d7d89f
user:      jym <jym%NetBSD.org@localhost>
date:      Tue Sep 06 21:39:30 2011 +0000

description:
/etc/defaults/rc.conf can be modified at build time by getting additional
arch-specific hooks appended to its end (currently: i386 and amd64).

Handle this case in postinstall(8) by checking whether we are in
$SOURCEMODE or not, and generate the correct rc.conf file on the fly in
case we have to. Otherwise, postinstall(8) may install the default one
obtained from a source directory that does not have the MD hooks
appended to it.

Problem reported by wiz@. Thanks!

diffstat:

 usr.sbin/postinstall/postinstall |  27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 1135ef856826 -r 4d4651d7d89f usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Tue Sep 06 21:32:29 2011 +0000
+++ b/usr.sbin/postinstall/postinstall  Tue Sep 06 21:39:30 2011 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.124 2011/09/06 14:13:46 jym Exp $
+# $NetBSD: postinstall,v 1.125 2011/09/06 21:39:30 jym Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -747,9 +747,32 @@
        op="$1"
        failed=0
 
+       # Except for i386 and amd64, rc.conf(5) should be the same as the
+       # one obtained from a source directory
+       extra_scripts="rc.conf"
+       if [ "$MACHINE" = "i386" -o "$MACHINE" = "amd64" ]; then
+               if $SOURCEMODE; then
+                       extra_scripts=  # clear
+
+                       # Generate and compare the correct rc.conf(5) file
+                       mkdir "${SCRATCHDIR}/defaults"
+
+                       cat "${SRC_DIR}/etc/defaults/rc.conf" \
+                           "${SRC_DIR}/etc/etc.${MACHINE}/rc.conf.append" \
+                           > "${SCRATCHDIR}/defaults/rc.conf"
+
+                       compare_dir "${op}" "${SCRATCHDIR}/defaults" \
+                           "${DEST_DIR}/etc/defaults" \
+                           444 \
+                           "rc.conf"
+                       failed=$(( ${failed} + $? ))
+               fi
+       fi
+
        compare_dir "$op" "${SRC_DIR}/etc/defaults" "${DEST_DIR}/etc/defaults" \
                444 \
-               daily.conf monthly.conf rc.conf security.conf weekly.conf
+               daily.conf monthly.conf security.conf \
+               weekly.conf ${extra_scripts}
        failed=$(( ${failed} + $? ))
 
        find_file_in_dirlist pf.boot.conf "pf.boot.conf" \



Home | Main Index | Thread Index | Old Index