Date: Wed, 18 Jan 2012 15:59:23 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r230309 - head/usr.sbin/bsdinstall/partedit Message-ID: <201201181559.q0IFxNVa046854@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Wed Jan 18 15:59:23 2012 New Revision: 230309 URL: http://svn.freebsd.org/changeset/base/230309 Log: 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 MFC after: 4 days Modified: head/usr.sbin/bsdinstall/partedit/partedit.c Modified: head/usr.sbin/bsdinstall/partedit/partedit.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/partedit.c Wed Jan 18 15:25:34 2012 (r230308) +++ head/usr.sbin/bsdinstall/partedit/partedit.c Wed Jan 18 15:59:23 2012 (r230309) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201181559.q0IFxNVa046854>