Module Name:    src
Committed By:   martin
Date:           Thu Feb  6 19:08:38 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: disks.c upgrade.c

Log Message:
PR bin/54944: make the "explicit single wedge" selection also work for
upgrades.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/sysinst/upgrade.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/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.64 src/usr.sbin/sysinst/disks.c:1.65
--- src/usr.sbin/sysinst/disks.c:1.64	Thu Feb  6 16:28:10 2020
+++ src/usr.sbin/sysinst/disks.c	Thu Feb  6 19:08:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.64 2020/02/06 16:28:10 martin Exp $ */
+/*	$NetBSD: disks.c,v 1.65 2020/02/06 19:08:38 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1446,7 +1446,8 @@ find_part_by_name(const char *name, stru
 		 * List has not been filled, only "pm" is valid - check
 		 * that first.
 		 */
-		if (pm->parts->pscheme->find_by_name != NULL) {
+		if (pm->parts != NULL &&
+		    pm->parts->pscheme->find_by_name != NULL) {
 			id = pm->parts->pscheme->find_by_name(pm->parts, name);
 			if (id != NO_PART) {
 				*pno = id;
@@ -1840,10 +1841,15 @@ mount_disks(struct install_partition_des
 	assert((size_t)(l - fstabbuf) == num_entries);
 
 	/* First the root device. */
-	if (target_already_root())
+	if (target_already_root()) {
 		/* avoid needing to call target_already_root() again */
 		targetroot_mnt[0] = 0;
-	else {
+	} else if (pm->no_part) {
+		snprintf(devdev, sizeof devdev, _PATH_DEV "%s", pm->diskdev);
+		error = mount_root(devdev, true, false, install);
+		if (error != 0 && error != EBUSY)
+			return -1;
+	} else {
 		for (i = 0; i < install->num; i++) {
 			if (is_root_part_mount(install->infos[i].mount))
 				break;

Index: src/usr.sbin/sysinst/upgrade.c
diff -u src/usr.sbin/sysinst/upgrade.c:1.14 src/usr.sbin/sysinst/upgrade.c:1.15
--- src/usr.sbin/sysinst/upgrade.c:1.14	Thu Jan 16 13:56:24 2020
+++ src/usr.sbin/sysinst/upgrade.c	Thu Feb  6 19:08:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: upgrade.c,v 1.14 2020/01/16 13:56:24 martin Exp $	*/
+/*	$NetBSD: upgrade.c,v 1.15 2020/02/06 19:08:38 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -65,19 +65,19 @@ do_upgrade(void)
 	if (find_disks(msg_string(MSG_upgrade), !root_is_read_only()) < 0)
 		return;
 
-	if (pm->parts == NULL && !pm->cur_system) {
+	if (pm->parts == NULL && !pm->cur_system && !pm->no_part) {
 		hit_enter_to_continue(MSG_noroot, NULL);
 		return;
 	}
 
-	if (!pm->cur_system) {
+	if (!pm->cur_system && pm->parts != NULL) {
 		if (pm->parts->pscheme->pre_update_verify) {
 			if (pm->parts->pscheme->pre_update_verify(pm->parts))
 				pm->parts->pscheme->write_to_disk(pm->parts);
 		}
 
 		install_desc_from_parts(&install, pm->parts);
-	} else {
+	} else if (pm->cur_system) {
 		install.cur_system = true;
 	}
 

Reply via email to