Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Ooops, backout previous - twice the entropy...



details:   https://anonhg.NetBSD.org/src/rev/08bfdbc95758
branches:  trunk
changeset: 932619:08bfdbc95758
user:      martin <martin%NetBSD.org@localhost>
date:      Tue May 12 17:04:00 2020 +0000

description:
Ooops, backout previous - twice the entropy saving is not needed.
Instead slightly improve the (slightly) hidden other code that already
did it.

diffstat:

 usr.sbin/sysinst/defs.h    |   3 +--
 usr.sbin/sysinst/install.c |   4 +---
 usr.sbin/sysinst/util.c    |  24 ++++++------------------
 3 files changed, 8 insertions(+), 23 deletions(-)

diffs (94 lines):

diff -r 42a952ab0a55 -r 08bfdbc95758 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Tue May 12 16:18:04 2020 +0000
+++ b/usr.sbin/sysinst/defs.h   Tue May 12 17:04:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.59 2020/05/12 16:18:04 martin Exp $ */
+/*     $NetBSD: defs.h,v 1.60 2020/05/12 17:04:00 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -809,7 +809,6 @@
 unsigned int    set_X11_selected(void);
 int    get_and_unpack_sets(int, msg, msg, msg);
 int    sanity_check(void);
-void   save_entropy(void);
 int    set_timezone(void);
 void   scripting_fprintf(FILE *, const char *, ...) __printflike(2, 3);
 void   scripting_vfprintf(FILE *, const char *, va_list) __printflike(2, 0);
diff -r 42a952ab0a55 -r 08bfdbc95758 usr.sbin/sysinst/install.c
--- a/usr.sbin/sysinst/install.c        Tue May 12 16:18:04 2020 +0000
+++ b/usr.sbin/sysinst/install.c        Tue May 12 17:04:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: install.c,v 1.15 2020/05/12 16:18:04 martin Exp $      */
+/*     $NetBSD: install.c,v 1.16 2020/05/12 17:04:00 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -229,8 +229,6 @@
 
        sanity_check();
 
-       save_entropy();
-
        md_cleanup_install(&install);
 
        hit_enter_to_continue(MSG_instcomplete, NULL);
diff -r 42a952ab0a55 -r 08bfdbc95758 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Tue May 12 16:18:04 2020 +0000
+++ b/usr.sbin/sysinst/util.c   Tue May 12 17:04:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.43 2020/05/12 16:18:04 martin Exp $ */
+/*     $NetBSD: util.c,v 1.44 2020/05/12 17:04:00 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1086,6 +1086,7 @@
        distinfo *dist;
        int status;
        int set, olderror, oldfound;
+       bool entropy_loaded = false;
 
        /* Ensure mountpoint for distribution files exists in current root. */
        (void)mkdir("/mnt2", S_IRWXU| S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH);
@@ -1203,7 +1204,8 @@
 
                /* Don't discard the system's old entropy if any */
                run_program(RUN_CHROOT | RUN_SILENT,
-                           "/etc/rc.d/random_seed start");
+                   "/etc/rc.d/random_seed start");
+               entropy_loaded = true;
        }
 
        /* Configure the system */
@@ -1245,7 +1247,8 @@
        umount_mnt2();
 
        /* Save entropy -- on some systems it's ~all we'll ever get */
-       run_program(RUN_DISPLAY | RUN_CHROOT | RUN_FATAL | RUN_PROGRESS,
+       if (!update || entropy_loaded)
+               run_program(RUN_SILENT | RUN_CHROOT | RUN_ERROR_OK,
                    "/etc/rc.d/random_seed stop");
        /* Install/Upgrade complete ... reboot or exit to script */
        hit_enter_to_continue(success_msg, NULL);
@@ -2199,21 +2202,6 @@
        free(install->infos);
 }
 
-/*
- * Called while at the end of install when targetroot is still mounted
- * and writable
- */
-void
-save_entropy(void)
-{
-
-       if (!binary_available("rndctl"))
-               return;
-
-       run_program(RUN_SILENT|RUN_ERROR_OK, "rndctl -S %s",
-           target_expand("/var/db/entropy-file"));
-}
-
 #ifdef MD_MAY_SWAP_TO
 bool
 may_swap_if_not_sdmmc(const char *disk)



Home | Main Index | Thread Index | Old Index