BootManager Disallow install to read-only drive (Bug #14596 & Bug #7200)

* Test for read-only devices during drive scan
   if read-only detected, flag it in ui and disallow installation

Change-Id: Idd9e8e94d4a4840df97939154e1bbec70d0c0ece
Reviewed-on: https://review.haiku-os.org/c/1026
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
Rob Gill
2019-02-11 14:55:33 +00:00
committed by Axel Dörfler
parent 2c218a0e8b
commit 8e3ccf2c01
2 changed files with 7 additions and 0 deletions
+4
View File
@@ -195,6 +195,10 @@ DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
message = B_TRANSLATE_COMMENT("Incompatible format!", message = B_TRANSLATE_COMMENT("Incompatible format!",
"Cannot install"); "Cannot install");
break; break;
case B_READ_ONLY_DEVICE:
message = B_TRANSLATE_COMMENT("Read only!",
"Cannot install");
break;
default: default:
message = B_TRANSLATE_COMMENT("Cannot access!", message = B_TRANSLATE_COMMENT("Cannot access!",
"Cannot install"); "Cannot install");
+3
View File
@@ -325,6 +325,9 @@ LegacyBootMenu::CanBeInstalled(const BootDrive& drive)
if (visitor.FirstOffset() < (int)sizeof(kBootLoader)) if (visitor.FirstOffset() < (int)sizeof(kBootLoader))
return B_PARTITION_TOO_SMALL; return B_PARTITION_TOO_SMALL;
if (device.IsReadOnlyMedia())
return B_READ_ONLY_DEVICE;
return B_OK; return B_OK;
} }