Module Name:    src
Committed By:   martin
Date:           Tue May 12 17:04:00 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: defs.h install.c util.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/sysinst/install.c
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/sysinst/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.59 src/usr.sbin/sysinst/defs.h:1.60
--- src/usr.sbin/sysinst/defs.h:1.59	Tue May 12 16:18:04 2020
+++ src/usr.sbin/sysinst/defs.h	Tue May 12 17:04:00 2020
@@ -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    get_kernel_set(void);
 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);

Index: src/usr.sbin/sysinst/install.c
diff -u src/usr.sbin/sysinst/install.c:1.15 src/usr.sbin/sysinst/install.c:1.16
--- src/usr.sbin/sysinst/install.c:1.15	Tue May 12 16:18:04 2020
+++ src/usr.sbin/sysinst/install.c	Tue May 12 17:04:00 2020
@@ -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 @@ do_install(void)
 
 	sanity_check();
 
-	save_entropy();
-
 	md_cleanup_install(&install);
 
 	hit_enter_to_continue(MSG_instcomplete, NULL);

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.43 src/usr.sbin/sysinst/util.c:1.44
--- src/usr.sbin/sysinst/util.c:1.43	Tue May 12 16:18:04 2020
+++ src/usr.sbin/sysinst/util.c	Tue May 12 17:04:00 2020
@@ -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 @@ get_and_unpack_sets(int update, msg setu
 	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 @@ get_and_unpack_sets(int update, msg setu
 
 		/* 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 @@ get_and_unpack_sets(int update, msg setu
 	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_desc(struct install_partiti
 	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)

Reply via email to