Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst At the end of a new installation save entropy.



details:   https://anonhg.NetBSD.org/src/rev/42a952ab0a55
branches:  trunk
changeset: 932618:42a952ab0a55
user:      martin <martin%NetBSD.org@localhost>
date:      Tue May 12 16:18:04 2020 +0000

description:
At the end of a new installation save entropy.

diffstat:

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

diffs (66 lines):

diff -r a9e07458fd50 -r 42a952ab0a55 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Tue May 12 16:17:58 2020 +0000
+++ b/usr.sbin/sysinst/defs.h   Tue May 12 16:18:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.58 2020/04/22 23:43:12 joerg Exp $  */
+/*     $NetBSD: defs.h,v 1.59 2020/05/12 16:18:04 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -809,6 +809,7 @@
 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 a9e07458fd50 -r 42a952ab0a55 usr.sbin/sysinst/install.c
--- a/usr.sbin/sysinst/install.c        Tue May 12 16:17:58 2020 +0000
+++ b/usr.sbin/sysinst/install.c        Tue May 12 16:18:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: install.c,v 1.14 2020/01/16 13:56:24 martin Exp $      */
+/*     $NetBSD: install.c,v 1.15 2020/05/12 16:18:04 martin Exp $      */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -229,6 +229,8 @@
 
        sanity_check();
 
+       save_entropy();
+
        md_cleanup_install(&install);
 
        hit_enter_to_continue(MSG_instcomplete, NULL);
diff -r a9e07458fd50 -r 42a952ab0a55 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Tue May 12 16:17:58 2020 +0000
+++ b/usr.sbin/sysinst/util.c   Tue May 12 16:18:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.42 2020/01/26 14:37:29 martin Exp $ */
+/*     $NetBSD: util.c,v 1.43 2020/05/12 16:18:04 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -2199,6 +2199,21 @@
        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