summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-09-14 16:26:56 -0300
committerRenato Botelho <renato@netgate.com>2017-09-14 16:27:36 -0300
commit37d8420afdef26fd66213e111d026e77df9bedca (patch)
treee9b02b98c88e040f8c5e6dfbd2de26d5808032e1 /usr.sbin/bsdinstall
parentbe75a199b8b3e116b822e22cc943da9152361f55 (diff)
downloadFreeBSD-src-37d8420afdef26fd66213e111d026e77df9bedca.zip
FreeBSD-src-37d8420afdef26fd66213e111d026e77df9bedca.tar.gz
Hide md* and disks that can not be used for write operations from installer
Diffstat (limited to 'usr.sbin/bsdinstall')
-rw-r--r--usr.sbin/bsdinstall/partedit/part_wizard.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c b/usr.sbin/bsdinstall/partedit/part_wizard.c
index e0eec9f..2a45cf1 100644
--- a/usr.sbin/bsdinstall/partedit/part_wizard.c
+++ b/usr.sbin/bsdinstall/partedit/part_wizard.c
@@ -100,7 +100,7 @@ boot_disk(struct gmesh *mesh)
const char *type, *desc;
char diskdesc[512];
char *chosen;
- int i, err, selected, n = 0;
+ int i, err, selected, fd, n = 0;
LIST_FOREACH(classp, &mesh->lg_class, lg_class) {
if (strcmp(classp->lg_name, "DISK") != 0 &&
@@ -127,6 +127,19 @@ boot_disk(struct gmesh *mesh)
continue;
if (strncmp(pp->lg_name, "cd", 2) == 0)
continue;
+ /* Skip memory disk used by factory mfsroot */
+ if (strncmp(pp->lg_name, "md", 2) == 0)
+ continue;
+
+ /*
+ * Check if disk is available to be open for
+ * write operations, it helps to prevent USB
+ * stick used to boot to be shown
+ */
+ fd = g_open(pp->lg_name, 1);
+ if (fd == -1)
+ continue;
+ g_close(fd);
disks = realloc(disks, (++n)*sizeof(disks[0]));
disks[n-1].name = pp->lg_name;
OpenPOWER on IntegriCloud