From e24e98d090601a50a56f845d2f6c628e0d7cd2ad Mon Sep 17 00:00:00 2001 From: Wojciech Macek Date: Mon, 5 Sep 2016 08:42:36 +0000 Subject: [PATCH] bsdinstall: add warning when unsupported partition is modified Right now is possible to modify bootable partition type to non-bootable type without getting warning from partedit. Example: if you auto parition drive for arm64, you will get freebsd-ufs as bootable partition; now you are able to change bootable partition type to freebsd-zfs; there will be no warning and the system will install but will not be bootable afterwards. After this fix, partedit will issue the same warning it does when user attempts to create bootable partition of not supported type, notyfing a user about incoming problem and allowing to think the decision over before commiting the schema. This has been tested on amd64 and arm64. Obtained from: Semihalf Submitted by: Dominik Ermel Sponsored by: Cavium Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D6879 --- usr.sbin/bsdinstall/partedit/gpart_ops.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index 89d75294e2a..9a5d82d65b4 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -617,6 +617,20 @@ editpart: if (choice) /* Cancel pressed */ goto endedit; + /* If this is the root partition, check that this fs is bootable */ + if (strcmp(items[2].text, "/") == 0 && !is_fs_bootable(scheme, + items[0].text)) { + char message[512]; + sprintf(message, "This file system (%s) is not bootable " + "on this system. Are you sure you want to proceed?", + items[0].text); + dialog_vars.defaultno = TRUE; + choice = dialog_yesno("Warning", message, 0, 0); + dialog_vars.defaultno = FALSE; + if (choice == 1) /* cancel */ + goto editpart; + } + /* Check if the label has a / in it */ if (strchr(items[3].text, '/') != NULL) { dialog_msgbox("Error", "Label contains a /, which is not an "