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:
@@ -121,8 +121,7 @@ AddSymlinkToPackage bin : trash : untrash ;
|
|||||||
AddSymlinkToPackage bin : less : more ;
|
AddSymlinkToPackage bin : less : more ;
|
||||||
|
|
||||||
# scripts and data files
|
# scripts and data files
|
||||||
local bootScripts = PostInstallScript SetupEnvironment
|
local bootScripts = PostInstallScript SetupEnvironment ;
|
||||||
InstallerInitScript InstallerFinishScript ;
|
|
||||||
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
||||||
AddFilesToPackage boot : $(bootScripts) ;
|
AddFilesToPackage boot : $(bootScripts) ;
|
||||||
|
|
||||||
|
|||||||
@@ -115,8 +115,7 @@ AddSymlinkToPackage bin : trash : untrash ;
|
|||||||
AddSymlinkToPackage bin : less : more ;
|
AddSymlinkToPackage bin : less : more ;
|
||||||
|
|
||||||
# scripts and data files
|
# scripts and data files
|
||||||
local bootScripts = PostInstallScript SetupEnvironment
|
local bootScripts = PostInstallScript SetupEnvironment ;
|
||||||
InstallerInitScript InstallerFinishScript ;
|
|
||||||
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
SEARCH on $(bootScripts) = [ FDirName $(HAIKU_TOP) data system boot ] ;
|
||||||
AddFilesToPackage boot : $(bootScripts) ;
|
AddFilesToPackage boot : $(bootScripts) ;
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
## The installer finish script.
|
|
||||||
|
|
||||||
target=$1
|
|
||||||
|
|
||||||
if [ -z "$target" ]; then
|
|
||||||
echo "Usage: $0 <volume>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$target" ]; then
|
|
||||||
echo "$target isn't mounted"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$target/system/cache/tmp"
|
|
||||||
|
|
||||||
# remove Installer link
|
|
||||||
rm -f "$target/home/Desktop/Installer"
|
|
||||||
|
|
||||||
makebootable "$target"
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
## The installer init script.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ WorkerThread::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_LaunchFinishScript(targetDirectory) != B_OK) {
|
if (_WriteBootSector(targetDirectory) != B_OK) {
|
||||||
_SetStatusMessage(
|
_SetStatusMessage(
|
||||||
B_TRANSLATE("Error writing boot sector."));
|
B_TRANSLATE("Error writing boot sector."));
|
||||||
break;
|
break;
|
||||||
@@ -304,17 +304,13 @@ WorkerThread::WriteBootSector(BMenu* targetMenu)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
WorkerThread::_LaunchInitScript(BPath &path)
|
WorkerThread::_WriteBootSector(BPath &path)
|
||||||
{
|
{
|
||||||
BPath bootPath;
|
BPath bootPath;
|
||||||
find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath);
|
find_directory(B_BEOS_BOOT_DIRECTORY, &bootPath);
|
||||||
BString command("/bin/sh ");
|
BString command;
|
||||||
command += bootPath.Path();
|
command.SetToFormat("makebootable \"%s\"", path.Path());
|
||||||
command += "/InstallerInitScript ";
|
_SetStatusMessage(B_TRANSLATE("Writing bootsector."));
|
||||||
command += "\"";
|
|
||||||
command += path.Path();
|
|
||||||
command += "\"";
|
|
||||||
_SetStatusMessage(B_TRANSLATE("Starting installation."));
|
|
||||||
return system(command.String());
|
return system(command.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,15 +318,14 @@ WorkerThread::_LaunchInitScript(BPath &path)
|
|||||||
status_t
|
status_t
|
||||||
WorkerThread::_LaunchFinishScript(BPath &path)
|
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."));
|
_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());
|
return system(command.String());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,10 +484,6 @@ WorkerThread::_PerformInstall(partition_id sourcePartitionID,
|
|||||||
CopyEngine engine(&reporter, &entryFilter);
|
CopyEngine engine(&reporter, &entryFilter);
|
||||||
BList unzipEngines;
|
BList unzipEngines;
|
||||||
|
|
||||||
err = _LaunchInitScript(targetDirectory);
|
|
||||||
if (err != B_OK)
|
|
||||||
return _InstallationError(err);
|
|
||||||
|
|
||||||
// Create the default indices which should always be present on a proper
|
// 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.
|
// 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
|
// 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)
|
if (err != B_OK)
|
||||||
return _InstallationError(err);
|
return _InstallationError(err);
|
||||||
|
|
||||||
|
err = _WriteBootSector(targetDirectory);
|
||||||
|
if (err != B_OK)
|
||||||
|
return _InstallationError(err);
|
||||||
|
|
||||||
err = _LaunchFinishScript(targetDirectory);
|
err = _LaunchFinishScript(targetDirectory);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return _InstallationError(err);
|
return _InstallationError(err);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
void WriteBootSector(BMenu* dstMenu);
|
void WriteBootSector(BMenu* dstMenu);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t _LaunchInitScript(BPath& path);
|
status_t _WriteBootSector(BPath& path);
|
||||||
status_t _LaunchFinishScript(BPath& path);
|
status_t _LaunchFinishScript(BPath& path);
|
||||||
|
|
||||||
status_t _PerformInstall(partition_id sourcePartitionID,
|
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
|
void
|
||||||
CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ public:
|
|||||||
void SetPackagesList(BList *list);
|
void SetPackagesList(BList *list);
|
||||||
void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; };
|
void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; };
|
||||||
private:
|
private:
|
||||||
void LaunchInitScript(BPath &path);
|
|
||||||
void LaunchFinishScript(BPath &path);
|
|
||||||
void CopyFolder(BDirectory &srcDir, BDirectory &targetDir);
|
void CopyFolder(BDirectory &srcDir, BDirectory &targetDir);
|
||||||
|
|
||||||
InstallerWindow *fWindow;
|
InstallerWindow *fWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user