Source-Changes-HG archive

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

[src/trunk]: src/etc Modify etc/defaults/Makefile so that architectures can s...



details:   https://anonhg.NetBSD.org/src/rev/24a78a2f0449
branches:  trunk
changeset: 768608:24a78a2f0449
user:      jym <jym%NetBSD.org@localhost>
date:      Mon Aug 22 18:54:05 2011 +0000

description:
Modify etc/defaults/Makefile so that architectures can specify an additional
rc.conf file. This one should reside under etc/etc.${MACHINE}/, and will
get automatically appended to etc/defaults/rc.conf at build time if present.

This is used by i386 and amd64 to append a small MD rc.conf(5) configuration
at the end of the defaults/rc.conf file, so that powerd(8) can be started
by default when we are running in a Xen environment. This is needed to support
save/restore functions for domains.

>From all the alternatives proposed to fix that issue (from /etc/rc.conf
parsing in postinstall to etc/defaults/rc.conf arch-hooks) I believe
this one will appease everyone because it:
- does not touch etc/defaults/rc.conf template file,
- patches it at build time for MD hooks only when required,
- does not need to parse/modify a user-specified file like /etc/rc.conf (which
is a complex, error-prone operation),
- only enables powerd(8) by default when conditions are met (Xen environment)
while still allowing root to shoot himself in the foot if he wants to
override this manually in /etc/rc.conf.

See also http://mail-index.netbsd.org/tech-userlevel/2011/07/25/msg005246.html

diffstat:

 etc/Makefile          |   4 ++--
 etc/defaults/Makefile |  20 ++++++++++++++++++--
 etc/defaults/rc.conf  |   3 ++-
 etc/etc.amd64/rc.conf |   9 +++++++++
 etc/etc.i386/rc.conf  |   9 +++++++++
 5 files changed, 40 insertions(+), 5 deletions(-)

diffs (87 lines):

diff -r 48559c53a302 -r 24a78a2f0449 etc/Makefile
--- a/etc/Makefile      Mon Aug 22 16:22:16 2011 +0000
+++ b/etc/Makefile      Mon Aug 22 18:54:05 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.391 2011/06/30 18:15:13 matt Exp $
+#      $NetBSD: Makefile,v 1.392 2011/08/22 18:54:05 jym Exp $
 #      from: @(#)Makefile      8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -630,7 +630,7 @@
 clean:
        -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
 
-SUBDIR=        rc.d mtree
+SUBDIR=        defaults rc.d mtree
 
 .include <bsd.prog.mk>
 .include <bsd.subdir.mk>
diff -r 48559c53a302 -r 24a78a2f0449 etc/defaults/Makefile
--- a/etc/defaults/Makefile     Mon Aug 22 16:22:16 2011 +0000
+++ b/etc/defaults/Makefile     Mon Aug 22 18:54:05 2011 +0000
@@ -1,7 +1,23 @@
-#      $NetBSD: Makefile,v 1.3 2004/05/16 09:53:09 lukem Exp $
+#      $NetBSD: Makefile,v 1.4 2011/08/22 18:54:06 jym Exp $
 
-CONFIGFILES=   daily.conf monthly.conf rc.conf security.conf weekly.conf
+.include <bsd.own.mk>
+
+CONFIGFILES=   daily.conf monthly.conf security.conf weekly.conf
 FILESDIR=      /etc/defaults
 FILESMODE=     ${NONBINMODE}
 
+# Manage arch-specific rc.conf(5) file
+CONFIGFILES+=  rc_conf
+FILESNAME_rc_conf=     rc.conf
+FILESBUILD_rc_conf=    yes
+
+RCCONF_SRCS=   ${.CURDIR}/rc.conf
+.if exists(../etc.${MACHINE}/rc.conf)
+RCCONF_SRCS+=  ${.CURDIR}/../etc.${MACHINE}/rc.conf
+.endif
+
+rc_conf: ${RCCONF_SRCS}
+       ${_MKTARGET_CREATE}
+       ${TOOL_CAT} ${RCCONF_SRCS} > ${.TARGET}
+
 .include <bsd.prog.mk>
diff -r 48559c53a302 -r 24a78a2f0449 etc/defaults/rc.conf
--- a/etc/defaults/rc.conf      Mon Aug 22 16:22:16 2011 +0000
+++ b/etc/defaults/rc.conf      Mon Aug 22 18:54:05 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.conf,v 1.113 2011/05/27 09:28:42 plunky Exp $
+#      $NetBSD: rc.conf,v 1.114 2011/08/22 18:54:06 jym Exp $
 #
 # /etc/defaults/rc.conf --
 #      default configuration of /etc/rc.conf
@@ -360,3 +360,4 @@
 veriexec_strict=0
 veriexec_verbose=0
 veriexec_flags="-k"
+
diff -r 48559c53a302 -r 24a78a2f0449 etc/etc.amd64/rc.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/etc.amd64/rc.conf     Mon Aug 22 18:54:05 2011 +0000
@@ -0,0 +1,9 @@
+#      $NetBSD: rc.conf,v 1.1 2011/08/22 18:54:06 jym Exp $
+#
+# Arch-specific rc.conf(5) configuration.
+
+# powerd(8) is required under Xen to manage save/restore events.
+#
+if /sbin/sysctl -q machdep.xen; then
+       powerd=YES
+fi
diff -r 48559c53a302 -r 24a78a2f0449 etc/etc.i386/rc.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/etc.i386/rc.conf      Mon Aug 22 18:54:05 2011 +0000
@@ -0,0 +1,9 @@
+#      $NetBSD: rc.conf,v 1.1 2011/08/22 18:54:06 jym Exp $
+#
+# Arch-specific rc.conf(5) configuration.
+
+# powerd(8) is required under Xen to manage save/restore events.
+#
+if /sbin/sysctl -q machdep.xen; then
+       powerd=YES
+fi



Home | Main Index | Thread Index | Old Index