From owner-svn-src-all@FreeBSD.ORG Sun Nov 6 16:37:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E3251065672; Sun, 6 Nov 2011 16:37:50 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8453B8FC08; Sun, 6 Nov 2011 16:37:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA6Gbo2x030454; Sun, 6 Nov 2011 16:37:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA6GboOB030450; Sun, 6 Nov 2011 16:37:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201111061637.pA6GboOB030450@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 6 Nov 2011 16:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227222 - in stable/9/usr.sbin/bsdinstall: partedit scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 16:37:50 -0000 Author: nwhitehorn Date: Sun Nov 6 16:37:50 2011 New Revision: 227222 URL: http://svn.freebsd.org/changeset/base/227222 Log: MFC r226666,226739,226741: Avoid showing the user some spurious error messages from GEOM [1] and do provide error messages instead of silent failure if there are no disks or no network interfaces in the system [2]. PR: bin/161926 [1], bin/161926 [2] Approved by: re (kib) Modified: stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c stable/9/usr.sbin/bsdinstall/partedit/partedit.c stable/9/usr.sbin/bsdinstall/scripts/netconfig Directory Properties: stable/9/usr.sbin/bsdinstall/ (props changed) Modified: stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Sun Nov 6 16:37:15 2011 (r227221) +++ stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Sun Nov 6 16:37:50 2011 (r227222) @@ -392,8 +392,14 @@ gpart_destroy(struct ggeom *lg_geom) gctl_ro_param(r, "force", sizeof(force), &force); gctl_ro_param(r, "verb", -1, "destroy"); errstr = gctl_issue(r); - if (errstr != NULL && errstr[0] != '\0') - gpart_show_error("Error", NULL, errstr); + if (errstr != NULL && errstr[0] != '\0') { + /* + * Check if we reverted away the existence of the geom + * altogether. Show all other errors to the user. + */ + if (strtol(errstr, NULL, 0) != EINVAL) + gpart_show_error("Error", NULL, errstr); + } gctl_free(r); /* And any metadata associated with the partition scheme itself */ @@ -450,6 +456,10 @@ gpart_edit(struct gprovider *pp) return; } + /* If this is a nested partition, edit as usual */ + if (strcmp(pp->lg_geom->lg_class->lg_name, "PART") == 0) + break; + /* Destroy the geom and all sub-partitions */ gpart_destroy(cp->lg_geom); @@ -507,7 +517,7 @@ editpart: choice = dlg_form("Edit Partition", "", 0, 0, 0, nitems, items, &junk); if (choice) /* Cancel pressed */ - return; + goto endedit; /* Check if the label has a / in it */ if (strchr(items[3].text, '/') != NULL) { @@ -538,6 +548,13 @@ editpart: items[2].text, (strcmp(oldtype, items[0].text) != 0) ? newfs : NULL); +endedit: + if (strcmp(oldtype, items[0].text) != 0 && cp != NULL) + gpart_destroy(cp->lg_geom); + if (strcmp(oldtype, items[0].text) != 0 && strcmp(items[0].text, + "freebsd") == 0) + gpart_partition(pp->lg_name, "BSD"); + for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) if (items[i].text_free) free(items[i].text); Modified: stable/9/usr.sbin/bsdinstall/partedit/partedit.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/partedit.c Sun Nov 6 16:37:15 2011 (r227221) +++ stable/9/usr.sbin/bsdinstall/partedit/partedit.c Sun Nov 6 16:37:50 2011 (r227222) @@ -70,7 +70,7 @@ main(int argc, const char **argv) { struct partition_metadata *md; const char *prompt; - struct partedit_item *items; + struct partedit_item *items = NULL; struct gmesh mesh; int i, op, nitems, nscroll; int error; @@ -99,12 +99,21 @@ main(int argc, const char **argv) /* Show the part editor either immediately, or to confirm wizard */ while (1) { - error = geom_gettree(&mesh); - items = read_geom_mesh(&mesh, &nitems); - get_mount_points(items, nitems); dlg_clear(); dlg_put_backtitle(); + error = geom_gettree(&mesh); + if (error == 0) + items = read_geom_mesh(&mesh, &nitems); + if (error || items == NULL) { + dialog_msgbox("Error", "No disks found. If you need to " + "install a kernel driver, choose Shell at the " + "installation menu.", 0, 0, TRUE); + break; + } + + get_mount_points(items, nitems); + if (i >= nitems) i = nitems - 1; op = diskeditor_show("Partition Editor", prompt, Modified: stable/9/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- stable/9/usr.sbin/bsdinstall/scripts/netconfig Sun Nov 6 16:37:15 2011 (r227221) +++ stable/9/usr.sbin/bsdinstall/scripts/netconfig Sun Nov 6 16:37:50 2011 (r227222) @@ -49,6 +49,13 @@ for IF in `ifconfig -l`; do DIALOG_TAGS="$DIALOG_TAGS $IF \"$DESC\"" done +if [ -z "$INTERFACES" ]; then + dialog --backtitle 'FreeBSD Installer' \ + --title 'Network Configuration Error' \ + --msgbox 'No network interfaces present to configure.' 0 0 + exit 1 +fi + exec 3>&1 INTERFACE=`echo $DIALOG_TAGS | xargs dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --menu 'Please select a network interface to configure:' 0 0 0 2>&1 1>&3` if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi