Module Name:    src
Committed By:   martin
Date:           Sun Oct  4 16:09:13 UTC 2020

Modified Files:
        src/usr.sbin/sysinst: bsddisklabel.c

Log Message:
If we have no explicitly marke target root partition, make sure to set
the proper flag on the implicit one.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/sysinst/bsddisklabel.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/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.46 src/usr.sbin/sysinst/bsddisklabel.c:1.47
--- src/usr.sbin/sysinst/bsddisklabel.c:1.46	Sat Oct  3 18:54:18 2020
+++ src/usr.sbin/sysinst/bsddisklabel.c	Sun Oct  4 16:09:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.46 2020/10/03 18:54:18 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.47 2020/10/04 16:09:12 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1774,6 +1774,35 @@ make_bsd_partitions(struct install_parti
 	}
 
 	/*
+	 * Make sure the target root partition is properly marked
+	 */
+	bool have_inst_target = false;
+	for (size_t i = 0; i < wanted.num; i++) {
+		if (wanted.infos[i].cur_flags & PTI_INSTALL_TARGET) {
+			have_inst_target = true;
+			break;
+		 }
+	}
+	if (!have_inst_target) {
+		for (size_t i = 0; i < wanted.num; i++) {
+			struct disk_part_info info;
+
+			if (wanted.infos[i].type != PT_root ||
+			    strcmp(wanted.infos[i].mount, "/") != 0) 
+				continue;
+			wanted.infos[i].cur_flags |= PTI_INSTALL_TARGET;
+
+			if (!wanted.parts->pscheme->get_part_info(wanted.parts,
+			    wanted.infos[i].cur_part_id, &info))
+				break;
+			info.flags |= PTI_INSTALL_TARGET;
+			wanted.parts->pscheme->set_part_info(wanted.parts,
+			    wanted.infos[i].cur_part_id, &info, NULL);
+			break;
+		}
+	}
+
+	/*
 	 * OK, we have a partition table. Give the user the chance to
 	 * edit it and verify it's OK, or abort altogether.
 	 */

Reply via email to