successfull SW update
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
9d440838e9
commit
d87baa8da9
@ -1884,6 +1884,20 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
|
||||
}
|
||||
auto chip = static_cast<xsc::Chip>(data[0]);
|
||||
auto copy = static_cast<xsc::Copy>(data[1]);
|
||||
const char *sourceStr = "unknown";
|
||||
if (sourceDir == SwUpdateSources::SD_0) {
|
||||
sourceStr = "SD 0";
|
||||
} else if (sourceDir == SwUpdateSources::SD_1) {
|
||||
sourceStr = "SD 1";
|
||||
} else {
|
||||
sourceStr = "tmp directory";
|
||||
}
|
||||
sif::info << "Executing SW update for Chip " << static_cast<int>(data[0]) << " Copy "
|
||||
<< static_cast<int>(data[1]) << " from " << sourceStr << std::endl;
|
||||
if (chip == CURRENT_CHIP and copy == CURRENT_COPY) {
|
||||
// Not allowed / possible. TODO: Dedicated returnvalue?
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
path prefixPath;
|
||||
if (sourceDir == SwUpdateSources::SD_0) {
|
||||
prefixPath = path(config::SD_0_MOUNT_POINT);
|
||||
@ -1896,8 +1910,8 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
|
||||
if (not exists(archivePath)) {
|
||||
return HasFileSystemIF::FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
ostringstream cmd("tar -xJvf");
|
||||
cmd << " " << archivePath;
|
||||
ostringstream cmd("tar -xJf", ios::app);
|
||||
cmd << " " << archivePath << " -C " << prefixPath;
|
||||
int result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction: SW Update Decompression");
|
||||
@ -1912,55 +1926,64 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
|
||||
// TODO: Custom returnvalue?
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
cmd.str("");
|
||||
cmd.clear();
|
||||
cmd << "xsc_mount_copy " << data[0] << " " << data[1];
|
||||
cmd << "xsc_mount_copy " << std::to_string(data[0]) << " " << std::to_string(data[1]);
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
std::string contextString = "CoreController::executeAction: SW Update Mounting " +
|
||||
std::to_string(data[0]) + " " + std::to_string(data[1]);
|
||||
utility::handleSystemError(result, contextString);
|
||||
}
|
||||
cmd.str("");
|
||||
cmd.clear();
|
||||
std::string xscMountDest = std::string(getXscMountDir(chip, copy));
|
||||
path obswDestPath = xscMountDest / config::OBSW_PATH;
|
||||
path xscMountDest(getXscMountDir(chip, copy));
|
||||
path obswDestPath = xscMountDest / path(relative(config::OBSW_PATH, "/"));
|
||||
cmd << "cp " << strippedImagePath << " " << obswDestPath;
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction: Copying SW update");
|
||||
}
|
||||
cmd.str("");
|
||||
cmd.clear();
|
||||
path obswVersionDestPath = xscMountDest / config::OBSW_VERSION_FILE_PATH;
|
||||
path obswVersionDestPath = xscMountDest / path(relative(config::OBSW_VERSION_FILE_PATH, "/"));
|
||||
cmd << "cp " << obswVersionFilePath << " " << obswVersionDestPath;
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction: Copying SW version file");
|
||||
}
|
||||
cmd.str("");
|
||||
cmd.clear();
|
||||
|
||||
// Set correct permission for both files
|
||||
cmd << "chmod 0755 " << obswDestPath;
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction: Copying SW permissions 0755");
|
||||
utility::handleSystemError(result,
|
||||
"CoreController::executeAction: Copying SW permissions 0755");
|
||||
}
|
||||
cmd.str("");
|
||||
cmd.clear();
|
||||
|
||||
cmd << "chmod 0644 " << obswVersionDestPath;
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::executeAction: Setting version file permission 0644");
|
||||
utility::handleSystemError(
|
||||
result, "CoreController::executeAction: Setting version file permission 0644");
|
||||
}
|
||||
cmd.str("");
|
||||
cmd.clear();
|
||||
|
||||
// TODO: This takes a long time and will block the core controller.. Maybe use command executor?
|
||||
// For now dont care..
|
||||
cmd << "writeprotect " << data[0] << " " << data[1] << " 1";
|
||||
cmd << "writeprotect " << std::to_string(data[0]) << " " << std::to_string(data[1]) << " 1";
|
||||
result = system(cmd.str().c_str());
|
||||
if (result != 0) {
|
||||
std::string contextString = "CoreController::executeAction: Writeprotecting " +
|
||||
std::to_string(data[0]) + " " + std::to_string(data[1]);
|
||||
utility::handleSystemError(result, contextString);
|
||||
}
|
||||
sif::info << "SW update complete" << std::endl;
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 847a9dc000da29ae6faca3c97eb0af660cf96572
|
||||
Subproject commit 4307620a56c1f030247e4ad4a73a8e07864dde92
|
Loading…
Reference in New Issue
Block a user