Installer: do not allow installing to read-only partitions.
This would probably not work, right? Fixes #14614.
This commit is contained in:
@@ -250,11 +250,9 @@ WorkerThread::ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu)
|
|||||||
BDiskDevice device;
|
BDiskDevice device;
|
||||||
BPartition *partition = NULL;
|
BPartition *partition = NULL;
|
||||||
|
|
||||||
printf("\nScanDisksPartitions source partitions begin\n");
|
|
||||||
SourceVisitor srcVisitor(srcMenu);
|
SourceVisitor srcVisitor(srcMenu);
|
||||||
fDDRoster.VisitEachMountedPartition(&srcVisitor, &device, &partition);
|
fDDRoster.VisitEachMountedPartition(&srcVisitor, &device, &partition);
|
||||||
|
|
||||||
printf("\nScanDisksPartitions target partitions begin\n");
|
|
||||||
TargetVisitor targetVisitor(targetMenu);
|
TargetVisitor targetVisitor(targetMenu);
|
||||||
fDDRoster.VisitEachPartition(&targetVisitor, &device, &partition);
|
fDDRoster.VisitEachPartition(&targetVisitor, &device, &partition);
|
||||||
}
|
}
|
||||||
@@ -775,9 +773,6 @@ bool
|
|||||||
SourceVisitor::Visit(BPartition *partition, int32 level)
|
SourceVisitor::Visit(BPartition *partition, int32 level)
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
printf("SourceVisitor::Visit(BPartition *) : %s '%s'\n",
|
|
||||||
(partition->GetPath(&path) == B_OK) ? path.Path() : "",
|
|
||||||
partition->ContentName());
|
|
||||||
|
|
||||||
if (partition->ContentType() == NULL)
|
if (partition->ContentType() == NULL)
|
||||||
return false;
|
return false;
|
||||||
@@ -834,23 +829,15 @@ TargetVisitor::Visit(BDiskDevice *device)
|
|||||||
bool
|
bool
|
||||||
TargetVisitor::Visit(BPartition *partition, int32 level)
|
TargetVisitor::Visit(BPartition *partition, int32 level)
|
||||||
{
|
{
|
||||||
BPath path;
|
|
||||||
if (partition->GetPath(&path) == B_OK)
|
|
||||||
printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path());
|
|
||||||
printf("TargetVisitor::Visit(BPartition *) : %s\n",
|
|
||||||
partition->ContentName());
|
|
||||||
|
|
||||||
if (partition->ContentSize() < 20 * 1024 * 1024) {
|
if (partition->ContentSize() < 20 * 1024 * 1024) {
|
||||||
// reject partitions which are too small anyway
|
// reject partitions which are too small anyway
|
||||||
// TODO: Could depend on the source size
|
// TODO: Could depend on the source size
|
||||||
printf(" too small\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (partition->CountChildren() > 0) {
|
if (partition->CountChildren() > 0) {
|
||||||
// Looks like an extended partition, or the device itself.
|
// Looks like an extended partition, or the device itself.
|
||||||
// Do not accept this as target...
|
// Do not accept this as target...
|
||||||
printf(" no leaf partition\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,9 +851,11 @@ TargetVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
isBootPartition = strcmp(BOOT_PATH, mountPoint.Path()) == 0;
|
isBootPartition = strcmp(BOOT_PATH, mountPoint.Path()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only non-boot BFS partitions are valid targets, but we want to display the
|
// Only writable non-boot BFS partitions are valid targets, but we want to
|
||||||
// other partitions as well, in order not to irritate the user.
|
// display the other partitions as well, to inform the user that they are
|
||||||
|
// detected but somehow not appropriate.
|
||||||
bool isValidTarget = isBootPartition == false
|
bool isValidTarget = isBootPartition == false
|
||||||
|
&& !partition->IsReadOnly()
|
||||||
&& partition->ContentType() != NULL
|
&& partition->ContentType() != NULL
|
||||||
&& strcmp(partition->ContentType(), kPartitionTypeBFS) == 0;
|
&& strcmp(partition->ContentType(), kPartitionTypeBFS) == 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user