Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/usr.sbin/sysinst Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/b423610d0282
branches: netbsd-7
changeset: 798760:b423610d0282
user: snj <snj%NetBSD.org@localhost>
date: Wed Dec 31 06:19:19 2014 +0000
description:
Pull up following revision(s) (requested by martin in ticket #357):
usr.sbin/sysinst/disks.c: revision 1.6
We can not rely on the existence of the "gpt" binary on install media -
make installation work without it (and without strange errors) again.
diffstat:
usr.sbin/sysinst/disks.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diffs (63 lines):
diff -r 71f5e14edc20 -r b423610d0282 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Wed Dec 31 06:17:24 2014 +0000
+++ b/usr.sbin/sysinst/disks.c Wed Dec 31 06:19:19 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disks.c,v 1.4.4.1 2014/08/23 03:44:02 riz Exp $ */
+/* $NetBSD: disks.c,v 1.4.4.2 2014/12/31 06:19:19 snj Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -106,8 +106,9 @@
#endif
static int fsck_preen(const char *, int, const char *);
static void fixsb(const char *, const char *, char);
-static int is_gpt(const char *);
+static bool is_gpt(const char *);
static int incoregpt(pm_devs_t *, partinfo *);
+static bool have_gpt_binary(void);
#ifndef DISK_NAMES
#define DISK_NAMES "wd", "sd", "ld", "raid"
@@ -576,12 +577,26 @@
return numdisks;
}
+static bool
+have_gpt_binary(void)
+{
+ static bool did_test = false;
+ static bool have_gpt;
+
+ if (!did_test) {
+ have_gpt = binary_available("gpt");
+ did_test = true;
+ }
+
+ return have_gpt;
+}
+
void
label_read(void)
{
/* Get existing/default label */
memset(&pm->oldlabel, 0, sizeof pm->oldlabel);
- if (! pm->gpt)
+ if (!have_gpt_binary() || !pm->gpt)
incorelabel(pm->diskdev, pm->oldlabel);
else
incoregpt(pm, pm->oldlabel);
@@ -1456,9 +1471,12 @@
return 0;
}
-static int
+static bool
is_gpt(const char *dev)
{
- return ! run_program(RUN_SILENT | RUN_ERROR_OK,
+ if (!have_gpt_binary())
+ return false;
+
+ return !run_program(RUN_SILENT | RUN_ERROR_OK,
"sh -c 'gpt show %s |grep -e Pri\\ GPT\\ table'", dev);
}
Home |
Main Index |
Thread Index |
Old Index