tech-userlevel archive

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

Re: Making powerd=YES default



On 01.08.2011 18:57, Alan Barrett wrote:
> On Mon, 01 Aug 2011, Jean-Yves Migeon wrote:
>> Quite frankly, I am more and more convinced that an additional
>> /etc/defaults/rc.md.conf is the right fix then. This one could be
>> included from /etc/defaults/rc.conf, apply some MD-specific changes,
>> and still let the user override the value in /etc/rc.conf if he wants to.
> 
> I suggest making the contents of /etc/defaults/rc.conf be
> machine-dependent.  A script run at build time could create it from MI
> and MD fragments.  Put powerd=NO in some of the fragments, and
> powerd=YES in other fragments.

So I came back to this idea, but implemented it a bit differently. See
the patch attached.

In essence, /etc/defaults/rc.conf includes an arch file (conditioned on
its presence), etc/defaults/rc.arch.conf. This file is found under
src/etc.MACHINE/rc.arch.conf.

At install time, if present, it's installed as a regular config file.

Now why I chose to do this; I investigated two different ways:

- do like MAKEDEV in etc/Makefile, and use a skeleton template to merge
a MI + MD defaults/rc.conf file. This was quite heavyweight, and also
required to move away rc.conf from the CONFIGFILES entry in etc/defaults
(or it will get overwritten during configinstall), and modify
etc/Makefile a bit.

- try to delegate the build logic (like done with the mtree subtree).
Changes within etc/Makefile are minimal, but this involved some
heavyweight tinkering in etc/defaults/Makefile as I would have to manage
two files (a MI one: rc.conf.base, and a MD one: rc.conf.MACHINE). This
would lead to rc.conf rename, for no big win in the end.

The proposed patch adresses all comments I have received so far, it
avoids etcupdate/postinstall modifications, end-user configuration has
still the last word with /etc/rc.conf, and brings a little advantage to
my previous suggestion: I am conditioning powerd=YES to the presence of
machdep.xen, so i386/amd64 users that aren't using Xen shouldn't be
impacted by this new dependency.

Thoughts? I'll be AFK for quite some time starting tomorrow afternoon,
so this leaves a few days for review...

Thanks!

-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Index: etc/defaults/Makefile
===================================================================
RCS file: /cvsroot/src/etc/defaults/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- etc/defaults/Makefile       16 May 2004 09:53:09 -0000      1.3
+++ etc/defaults/Makefile       2 Aug 2011 18:57:40 -0000
@@ -4,4 +4,10 @@ CONFIGFILES=   daily.conf monthly.conf rc.
 FILESDIR=      /etc/defaults
 FILESMODE=     ${NONBINMODE}
 
+# Handle arch-specific rc.conf(5) file
+.if exists(../etc.${MACHINE}/rc.arch.conf)
+.PATH: ${.CURDIR}/../etc.${MACHINE}
+CONFIGFILES+=  rc.arch.conf
+.endif
+
 .include <bsd.prog.mk>
Index: etc/defaults/rc.conf
===================================================================
RCS file: /cvsroot/src/etc/defaults/rc.conf,v
retrieving revision 1.113
diff -u -p -r1.113 rc.conf
--- etc/defaults/rc.conf        27 May 2011 09:28:42 -0000      1.113
+++ etc/defaults/rc.conf        2 Aug 2011 18:57:40 -0000
@@ -360,3 +360,9 @@ veriexec=NO
 veriexec_strict=0
 veriexec_verbose=0
 veriexec_flags="-k"
+
+# Arch-specific configuration overrides.
+#
+if [ -r /etc/defaults/rc.arch.conf ]; then
+       . /etc/defaults/rc.arch.conf
+fi
--- /dev/null   2011-08-02 20:57:03.000000000 +0200
+++ etc/etc.i386/rc.arch.conf   2011-08-02 20:32:13.000000000 +0200
@@ -0,0 +1,9 @@
+#      $NetBSD$
+#
+# Arch-specific rc.conf(5) configuration.
+
+# powerd(8) is required under Xen to manage save/restore events.
+#
+if /sbin/sysctl machdep.xen >/dev/null 2>&1; then
+       powerd=YES
+fi
--- /dev/null   2011-08-02 20:57:03.000000000 +0200
+++ etc/etc.amd64/rc.arch.conf  2011-08-02 20:32:30.000000000 +0200
@@ -0,0 +1,9 @@
+#      $NetBSD$
+#
+# Arch-specific rc.conf(5) configuration.
+
+# powerd(8) is required under Xen to manage save/restore events.
+#
+if /sbin/sysctl machdep.xen >/dev/null 2>&1; then
+       powerd=YES
+fi


Home | Main Index | Thread Index | Old Index