Installer: separate writing bootsector from other install finishing code
Remove the InstallerInitScript (it does nothing) and the InstallerFinishScript (it does too many things). Instead implement the finishing directly in Installer. Separate writing the bootsector, so that the "write bootsector" menu writes only the bootsector. Fixes #16303
This commit is contained in:
@@ -227,7 +227,7 @@ WorkerThread::MessageReceived(BMessage* message)
|
||||
}
|
||||
}
|
||||
|
||||
if (_LaunchFinishScript(targetDirectory) != B_OK) {
|
||||
if (_WriteBootSector(targetDirectory) != B_OK) {
|
||||
_SetStatusMessage(
|
||||
B_TRANSLATE("Error writing boot sector."));
|
||||
break;
|
||||
@@ -304,17 +304,13 @@ WorkerThread::WriteBootSector(BMenu* targetMenu)
|
||||
|
||||
|
||||
status_t
|
||||
WorkerThread::_LaunchInitScript(BPath &path)
|
||||
WorkerThread::_WriteBootSector(BPath &path)
|
||||
{
|
||||
BPath bootPath;
|
||||
find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath);
|
||||
BString command("/bin/sh ");
|
||||
command += bootPath.Path();
|
||||
command += "/InstallerInitScript ";
|
||||
command += "\"";
|
||||
command += path.Path();
|
||||
command += "\"";
|
||||
_SetStatusMessage(B_TRANSLATE("Starting installation."));
|
||||
BString command;
|
||||
command.SetToFormat("makebootable \"%s\"", path.Path());
|
||||
_SetStatusMessage(B_TRANSLATE("Writing bootsector."));
|
||||
return system(command.String());
|
||||
}
|
||||
|
||||
@@ -322,15 +318,14 @@ WorkerThread::_LaunchInitScript(BPath &path)
|
||||
status_t
|
||||
WorkerThread::_LaunchFinishScript(BPath &path)
|
||||
{
|
||||
BPath bootPath;
|
||||
find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath);
|
||||
BString command("/bin/sh ");
|
||||
command += bootPath.Path();
|
||||
command += "/InstallerFinishScript ";
|
||||
command += "\"";
|
||||
command += path.Path();
|
||||
command += "\"";
|
||||
_SetStatusMessage(B_TRANSLATE("Finishing installation."));
|
||||
|
||||
BString command;
|
||||
command.SetToFormat("mkdir -p \"%s/system/cache/tmp\"", path.Path());
|
||||
if (system(command.String()) != 0)
|
||||
return B_ERROR;
|
||||
|
||||
command.SetToFormat("rm -f \"%s/home/Desktop/Installer\"", path.Path());
|
||||
return system(command.String());
|
||||
}
|
||||
|
||||
@@ -489,10 +484,6 @@ WorkerThread::_PerformInstall(partition_id sourcePartitionID,
|
||||
CopyEngine engine(&reporter, &entryFilter);
|
||||
BList unzipEngines;
|
||||
|
||||
err = _LaunchInitScript(targetDirectory);
|
||||
if (err != B_OK)
|
||||
return _InstallationError(err);
|
||||
|
||||
// Create the default indices which should always be present on a proper
|
||||
// boot volume. We don't care if the source volume does not have them.
|
||||
// After all, the user might be re-installing to another drive and may
|
||||
@@ -579,6 +570,10 @@ WorkerThread::_PerformInstall(partition_id sourcePartitionID,
|
||||
if (err != B_OK)
|
||||
return _InstallationError(err);
|
||||
|
||||
err = _WriteBootSector(targetDirectory);
|
||||
if (err != B_OK)
|
||||
return _InstallationError(err);
|
||||
|
||||
err = _LaunchFinishScript(targetDirectory);
|
||||
if (err != B_OK)
|
||||
return _InstallationError(err);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
void WriteBootSector(BMenu* dstMenu);
|
||||
|
||||
private:
|
||||
status_t _LaunchInitScript(BPath& path);
|
||||
status_t _WriteBootSector(BPath& path);
|
||||
status_t _LaunchFinishScript(BPath& path);
|
||||
|
||||
status_t _PerformInstall(partition_id sourcePartitionID,
|
||||
|
||||
@@ -55,34 +55,6 @@ CopyEngine::SetStatusMessage(char *status)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CopyEngine::LaunchInitScript(BPath &path)
|
||||
{
|
||||
BPath bootPath;
|
||||
find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath);
|
||||
BString command("/bin/sh ");
|
||||
command += bootPath.Path();
|
||||
command += "/InstallerInitScript ";
|
||||
command += path.Path();
|
||||
SetStatusMessage("Starting Installation.");
|
||||
system(command.String());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CopyEngine::LaunchFinishScript(BPath &path)
|
||||
{
|
||||
BPath bootPath;
|
||||
find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath);
|
||||
BString command("/bin/sh ");
|
||||
command += bootPath.Path();
|
||||
command += "/InstallerFinishScript ";
|
||||
command += path.Path();
|
||||
SetStatusMessage("Finishing Installation.");
|
||||
system(command.String());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
||||
{
|
||||
|
||||
@@ -26,8 +26,6 @@ public:
|
||||
void SetPackagesList(BList *list);
|
||||
void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; };
|
||||
private:
|
||||
void LaunchInitScript(BPath &path);
|
||||
void LaunchFinishScript(BPath &path);
|
||||
void CopyFolder(BDirectory &srcDir, BDirectory &targetDir);
|
||||
|
||||
InstallerWindow *fWindow;
|
||||
|
||||
Reference in New Issue
Block a user