From owner-svn-src-all@FreeBSD.ORG Sun Feb 5 16:08:46 2012 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 49C13106566C; Sun, 5 Feb 2012 16:08:46 +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 1D5058FC08; Sun, 5 Feb 2012 16:08:46 +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 q15G8jeZ090307; Sun, 5 Feb 2012 16:08:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q15G8jqp090305; Sun, 5 Feb 2012 16:08:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201202051608.q15G8jqp090305@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 5 Feb 2012 16:08:45 +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: r231020 - stable/9/usr.sbin/bsdinstall/partedit 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, 05 Feb 2012 16:08:46 -0000 Author: nwhitehorn Date: Sun Feb 5 16:08:45 2012 New Revision: 231020 URL: http://svn.freebsd.org/changeset/base/231020 Log: MFC r230309: Warn if trying to install over an existing partition, which usually fails anyway due to libarchive not being able to overwrite schg flags. PR: bin/164278 Modified: stable/9/usr.sbin/bsdinstall/partedit/partedit.c Directory Properties: stable/9/usr.sbin/bsdinstall/ (props changed) stable/9/usr.sbin/bsdinstall/scripts/ (props changed) Modified: stable/9/usr.sbin/bsdinstall/partedit/partedit.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/partedit.c Sun Feb 5 15:59:18 2012 (r231019) +++ stable/9/usr.sbin/bsdinstall/partedit/partedit.c Sun Feb 5 16:08:45 2012 (r231020) @@ -240,23 +240,41 @@ delete_part_metadata(const char *name) static int validate_setup(void) { - struct partition_metadata *md; - int root_found = FALSE; + struct partition_metadata *md, *root = NULL; + int cancel; TAILQ_FOREACH(md, &part_metadata, metadata) { if (md->fstab != NULL && strcmp(md->fstab->fs_file, "/") == 0) - root_found = TRUE; + root = md; /* XXX: Check for duplicate mountpoints */ } - if (!root_found) { + if (root == NULL) { dialog_msgbox("Error", "No root partition was found. " "The root FreeBSD partition must have a mountpoint of '/'.", 0, 0, TRUE); return (FALSE); } + /* + * Check for root partitions that we aren't formatting, which is + * usually a mistake + */ + if (root->newfs == NULL) { + dialog_vars.defaultno = TRUE; + cancel = dialog_yesno("Warning", "The chosen root partition " + "has a preexisting filesystem. If it contains an existing " + "FreeBSD system, please update it with freebsd-update " + "instead of installing a new system on it. The partition " + "can also be erased by pressing \"No\" and then deleting " + "and recreating it. Are you sure you want to proceed?", + 0, 0); + dialog_vars.defaultno = FALSE; + if (cancel) + return (FALSE); + } + return (TRUE); }