tech-userlevel archive

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

Re: Making powerd=YES default



On 31.07.2011 21:20, Martin Husemann wrote:
> On Sun, Jul 31, 2011 at 08:15:56PM +0200, Jean-Yves Migeon wrote:
>> Why I am suggesting this: as rc.conf gets patched directly in the MD
>> sets, it will be managed by etcupdate(8). So anyone who is updating is
>> seeing the wscons/powerd=YES lines now, instead of just those that use
>> sysinst-install.
> 
> Not everyone uses etcupdate.
> Will an official update via sysinst now have the correct values in rc.conf?

Good point; nope. That's something you can only do via postinstall(8).

From what I have seen so far, there are multiple situations to check:
1 - install from scratch. Handled either via add_rc_conf(...) (available
only via sysinst), or attached patch (which adds the option directly in
i386/amd64 etc.tgz set)
2 - update using sets + postinstall + etcupdate. Handled only via
postinstall or etcupdate, obviously.
3 - update via sysinst. Only handled via postinstall.
4 - using build.sh install=<target>, and configure <target>/etc/ afterwards.
5 - fully manual. At operator's own risk.

IMHO, the only way to cover most of the possibilities is to add the
powerd=YES line directly inside etc.tgz set, which will happen at
"build.sh distribution" time. That will cover most (all?) install methods.

For upgrade, I patched postinstall(8). It won't fix the issue by itself,
but will raise a warning in case it's not enabled.

Thoughts?

-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost
Index: distrib/utils/sysinst/arch/i386/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/i386/md.c,v
retrieving revision 1.128
diff -u -p -r1.128 md.c
--- distrib/utils/sysinst/arch/i386/md.c        4 Apr 2011 08:30:32 -0000       
1.128
+++ distrib/utils/sysinst/arch/i386/md.c        31 Jul 2011 17:35:33 -0000
@@ -386,7 +386,6 @@ md_cleanup_install(void)
 {
 #ifndef DEBUG
        enable_rc_conf();
-       add_rc_conf("wscons=YES\n");
 
 # if defined(__i386__) && defined(SET_KERNEL_TINY)
        /*
Index: distrib/utils/sysinst/arch/shark/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/shark/md.c,v
retrieving revision 1.26
diff -u -p -r1.26 md.c
--- distrib/utils/sysinst/arch/shark/md.c       4 Apr 2011 08:30:42 -0000       
1.26
+++ distrib/utils/sysinst/arch/shark/md.c       31 Jul 2011 17:35:33 -0000
@@ -177,7 +177,6 @@ md_cleanup_install(void)
 {
 #ifndef DEBUG
        enable_rc_conf();
-       add_rc_conf("wscons=YES\n");
 
        /* Configure a single screen. */
        run_program(RUN_CHROOT,
Index: etc/Makefile
===================================================================
RCS file: /cvsroot/src/etc/Makefile,v
retrieving revision 1.391
diff -u -p -r1.391 Makefile
--- etc/Makefile        30 Jun 2011 18:15:13 -0000      1.391
+++ etc/Makefile        31 Jul 2011 17:35:33 -0000
@@ -94,17 +94,23 @@ BIN1+=      bootptab changelist csh.cshrc csh
        locate.conf login.conf mailer.conf man.conf monthly monthly.conf \
        mrouted.conf named.conf netconfig networks newsyslog.conf \
        nsswitch.conf ntp.conf passwd.conf phones printcap profile protocols \
-       rbootd.conf rc rc.conf rc.local rc.subr rc.shutdown remote rpc \
+       rbootd.conf rc rc.local rc.subr rc.shutdown remote rpc \
        security security.conf services shells shrc sysctl.conf syslog.conf \
        weekly weekly.conf wscons.conf
 
-# Use machine-specific disktab if it exists, or the MI one otherwise
+# Use MD disktab and rc.conf if they exist, or the MI ones otherwise
 .if exists(etc.${MACHINE}/disktab)
 BIN1+= etc.${MACHINE}/disktab
 .else
 BIN1+= disktab
 .endif
 
+.if exists(etc.${MACHINE}/rc.conf)
+BIN1+= etc.${MACHINE}/rc.conf
+.else
+BIN1+= rc.conf
+.endif
+
 .if exists(etc.${MACHINE}/ld.so.conf)
 BIN1+= etc.${MACHINE}/ld.so.conf
 .endif
--- /dev/null   2011-07-31 19:32:05.000000000 +0200
+++ etc/etc.amd64/rc.conf       2011-07-31 18:49:57.000000000 +0200
@@ -0,0 +1,23 @@
+#      $NetBSD: rc.conf,v 1.96 2000/10/14 17:01:29 wiz Exp $
+#
+# see rc.conf(5) for more information.
+#
+# Use program=YES to enable program, NO to disable it. program_flags are
+# passed to the program on the command line.
+#
+
+# Load the defaults in from /etc/defaults/rc.conf (if it's readable).
+# These can be overridden below.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+       . /etc/defaults/rc.conf
+fi
+
+# If this is not set to YES, the system will drop into single-user mode.
+#
+rc_configured=NO
+
+# Add local overrides below
+#
+wscons=YES
+powerd=YES
--- /dev/null   2011-07-31 19:32:05.000000000 +0200
+++ etc/etc.i386/rc.conf        2011-07-31 18:49:47.000000000 +0200
@@ -0,0 +1,23 @@
+#      $NetBSD: rc.conf,v 1.96 2000/10/14 17:01:29 wiz Exp $
+#
+# see rc.conf(5) for more information.
+#
+# Use program=YES to enable program, NO to disable it. program_flags are
+# passed to the program on the command line.
+#
+
+# Load the defaults in from /etc/defaults/rc.conf (if it's readable).
+# These can be overridden below.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+       . /etc/defaults/rc.conf
+fi
+
+# If this is not set to YES, the system will drop into single-user mode.
+#
+rc_configured=NO
+
+# Add local overrides below
+#
+wscons=YES
+powerd=YES
--- /dev/null   2011-07-31 19:32:05.000000000 +0200
+++ etc/etc.shark/rc.conf       2011-07-31 18:52:21.000000000 +0200
@@ -0,0 +1,22 @@
+#      $NetBSD: rc.conf,v 1.96 2000/10/14 17:01:29 wiz Exp $
+#
+# see rc.conf(5) for more information.
+#
+# Use program=YES to enable program, NO to disable it. program_flags are
+# passed to the program on the command line.
+#
+
+# Load the defaults in from /etc/defaults/rc.conf (if it's readable).
+# These can be overridden below.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+       . /etc/defaults/rc.conf
+fi
+
+# If this is not set to YES, the system will drop into single-user mode.
+#
+rc_configured=NO
+
+# Add local overrides below
+#
+wscons=YES
Index: usr.sbin/postinstall/postinstall
===================================================================
RCS file: /cvsroot/src/usr.sbin/postinstall/postinstall,v
retrieving revision 1.120
diff -u -p -r1.120 postinstall
--- usr.sbin/postinstall/postinstall    14 Jul 2011 09:35:24 -0000      1.120
+++ usr.sbin/postinstall/postinstall    31 Jul 2011 22:52:31 -0000
@@ -805,6 +805,35 @@ do_envsys()
 }
 
 #
+#      powerd
+#
+additem powerd "powerd configuration is up to date"
+do_powerd()
+{
+       [ -n "$1" ] || err 3 "USAGE: do_powerd fix|check"
+       op="$1"
+       failed=0
+       notfixed=""
+
+       if [ "${op}" = "fix" ]; then
+               notfixed="${NOT_FIXED}"
+       fi
+
+       # Starting with NetBSD-6.0, powerd(8) has to be enabled under
+       # i386/amd64 to support Xen domU save/restore.
+       if [ "$MACHINE" = "i386" ] || [ "$MACHINE" = "amd64" ]; then
+               if ! rcvar_is_enabled "powerd"; then
+                       msg \
+           "powerd(8) is not enabled in rc.conf(5)${notfixed}: use powerd=YES"
+                       failed=$(( ${failed} + 1 ))
+               fi
+       fi
+
+       return ${failed}
+
+}
+
+#
 #      X11 fontconfig
 #
 additem fontconfig "X11 font configuration is up to date"


Home | Main Index | Thread Index | Old Index