* Prevent to copy the "var" and "_packages_" folders from the source volume
root folder as before switching the CopyEngine. * Add a button "Write Boot Sector" that makes the selected target volume bootable without performing an installation. Adjusted the status message after installation to be more descriptive. * Small improvements in the CopyEngine, collecting the source size should be even a bit faster now since we can use the file size from the already performed stat(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30395 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -75,15 +75,61 @@ CopyEngine::CopyEngine(InstallerWindow *window)
|
||||
|
||||
|
||||
void
|
||||
CopyEngine::MessageReceived(BMessage*msg)
|
||||
CopyEngine::MessageReceived(BMessage* message)
|
||||
{
|
||||
CALLED();
|
||||
switch (msg->what) {
|
||||
|
||||
switch (message->what) {
|
||||
case ENGINE_START:
|
||||
{
|
||||
Start(fWindow->GetSourceMenu(), fWindow->GetTargetMenu());
|
||||
break;
|
||||
|
||||
case kWriteBootSector:
|
||||
{
|
||||
int32 id;
|
||||
if (message->FindInt32("id", &id) != B_OK) {
|
||||
SetStatusMessage("Boot sector not written because of an "
|
||||
" internal error.");
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Refactor with Start()
|
||||
BPath targetDirectory;
|
||||
BDiskDevice device;
|
||||
BPartition* partition;
|
||||
|
||||
if (fDDRoster.GetPartitionWithID(id, &device, &partition) == B_OK) {
|
||||
if (!partition->IsMounted()) {
|
||||
if (partition->Mount() < B_OK) {
|
||||
SetStatusMessage("The partition can't be mounted. "
|
||||
"Please choose a different partition.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (partition->GetMountPoint(&targetDirectory) != B_OK) {
|
||||
SetStatusMessage("The mount point could not be retrieve.");
|
||||
break;
|
||||
}
|
||||
} else if (fDDRoster.GetDeviceWithID(id, &device) == B_OK) {
|
||||
if (!device.IsMounted()) {
|
||||
if (device.Mount() < B_OK) {
|
||||
SetStatusMessage("The disk can't be mounted. Please "
|
||||
"choose a different disk.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (device.GetMountPoint(&targetDirectory) != B_OK) {
|
||||
SetStatusMessage("The mount point could not be retrieve.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LaunchFinishScript(targetDirectory);
|
||||
// TODO: Get error from executing script!
|
||||
SetStatusMessage("Boot sector successfully written.");
|
||||
}
|
||||
default:
|
||||
BLooper::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,6 +444,24 @@ CopyEngine::Cancel()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CopyEngine::WriteBootSector(BMenu* targetMenu)
|
||||
{
|
||||
// Executed in window thread.
|
||||
CALLED();
|
||||
|
||||
PartitionMenuItem* item = (PartitionMenuItem*)targetMenu->FindMarked();
|
||||
if (item == NULL) {
|
||||
ERR("bad menu items\n");
|
||||
return;
|
||||
}
|
||||
|
||||
BMessage message(kWriteBootSector);
|
||||
message.AddInt32("id", item->ID());
|
||||
PostMessage(&message, this);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user