Check if USB/SD is mounted and get dc-controller from etc/dc.
This commit is contained in:
@@ -133,7 +133,6 @@ int main(int argc, char **argv) {
|
|||||||
QString const &customerRepo
|
QString const &customerRepo
|
||||||
= QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
= QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QString const &psaDcDir = internal::customerRepoDcDir();
|
QString const &psaDcDir = internal::customerRepoDcDir();
|
||||||
QString const &psaRepoRootDir = internal::customerRepoRoot();
|
QString const &psaRepoRootDir = internal::customerRepoRoot();
|
||||||
QString const &psaRepoDir = internal::customerRepoDir();
|
QString const &psaRepoDir = internal::customerRepoDir();
|
||||||
@@ -145,7 +144,6 @@ int main(int argc, char **argv) {
|
|||||||
QString libca;
|
QString libca;
|
||||||
|
|
||||||
std::unique_ptr<QSettings> settings = internal::readSettings();
|
std::unique_ptr<QSettings> settings = internal::readSettings();
|
||||||
|
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings->beginGroup("ATBUpdateDC");
|
settings->beginGroup("ATBUpdateDC");
|
||||||
debug = settings->value("debug", false).toBool();
|
debug = settings->value("debug", false).toBool();
|
||||||
@@ -154,21 +152,37 @@ int main(int argc, char **argv) {
|
|||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
qInfo() << " using dc directory: " << psaDcDir;
|
||||||
|
qInfo() << "using psa repo root directory: " << psaRepoRootDir;
|
||||||
|
qInfo() << " using customer repository: " << psaRepoDir;
|
||||||
|
qInfo() << " using branch: " << branchName;
|
||||||
|
}
|
||||||
|
|
||||||
// etc/dc: located under mount-path
|
// etc/dc: located under mount-path
|
||||||
std::optional<QString> mountPath = System::checkForUSBStick(psaDcDir);
|
std::optional<QString> mountPath = System::checkForUSBStick(psaDcDir);
|
||||||
QFileInfo fi;
|
QFileInfo fi;
|
||||||
if (mountPath.has_value()) {
|
if (mountPath.has_value()) {
|
||||||
fi.setFile(mountPath.value(), System::getDCFileOnUsbStick(mountPath.value()));
|
if (debug) {
|
||||||
|
qInfo() << "using mount path (USB): " << mountPath.value();
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
|
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
|
||||||
fi.setFile(mountPath.value(), System::getDCFileOnSDCard(mountPath.value()));
|
if (debug) {
|
||||||
|
qInfo() << "using mount path (SD): " << mountPath.value();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qInfo() << "using customer repository" << psaRepoDir;
|
qInfo() << "using customer repository" << psaRepoDir;
|
||||||
}
|
}
|
||||||
|
mountPath = "";
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<QString> c = internal::dcCandidateToInstall("/etc/dc/");
|
if (debug) {
|
||||||
|
qInfo() << "using mount path: " << mountPath.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<QString> c = internal::dcCandidateToInstall("/etc/dc/", mountPath.value());
|
||||||
if (c) {
|
if (c) {
|
||||||
fi.setFile(*c);
|
fi.setFile(*c);
|
||||||
if (fi.exists() == false) {
|
if (fi.exists() == false) {
|
||||||
@@ -177,7 +191,6 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
qInfo() << "dc2c.bin canditate" << fi.absoluteFilePath();
|
qInfo() << "dc2c.bin canditate" << fi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qInfo() << "downloading dc-firmware" << fi.absoluteFilePath();
|
qInfo() << "downloading dc-firmware" << fi.absoluteFilePath();
|
||||||
@@ -185,6 +198,9 @@ int main(int argc, char **argv) {
|
|||||||
qInfo() << "dc-version" << Update::dcVersion(fi.absoluteFilePath());
|
qInfo() << "dc-version" << Update::dcVersion(fi.absoluteFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only for testing
|
||||||
|
// return 0;
|
||||||
|
|
||||||
Update u(fi.absoluteFilePath(), libca, debug, noaction);
|
Update u(fi.absoluteFilePath(), libca, debug, noaction);
|
||||||
u.run();
|
u.run();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user