ATBDownloadDC: need single argument: bin-file name
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <QByteArray>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QCommandLineParser>
|
||||
#include <QStandardPaths>
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
@@ -65,9 +64,7 @@ int main(int argc, char **argv) {
|
||||
setDebugLevel(LOG_NOTICE);
|
||||
}
|
||||
|
||||
//return 0;
|
||||
|
||||
/*
|
||||
/*
|
||||
CommandLineParser parser;
|
||||
parser.process(a);
|
||||
parser.readSettings();
|
||||
@@ -129,21 +126,13 @@ int main(int argc, char **argv) {
|
||||
printf(APP_EXTENDED_VERSION"\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString const &customerRepo
|
||||
= QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
||||
*/
|
||||
|
||||
QString const &psaDcDir = internal::customerRepoDcDir();
|
||||
QString const &psaRepoRootDir = internal::customerRepoRoot();
|
||||
QString const &psaRepoDir = internal::customerRepoDir();
|
||||
QString const &branchName = internal::branchName();
|
||||
*/
|
||||
|
||||
bool debug = false;
|
||||
bool noaction = true;
|
||||
QString workingDir;
|
||||
QString libDir;
|
||||
QString libca;
|
||||
QString workingDir;
|
||||
|
||||
std::unique_ptr<QSettings> settings = internal::readSettings();
|
||||
|
||||
@@ -162,37 +151,37 @@ int main(int argc, char **argv) {
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
// etc/dc: located under mount-path
|
||||
std::optional<QString> mountPath = System::checkForUSBStick(psaDcDir);
|
||||
QFileInfo fi;
|
||||
if (mountPath.has_value()) {
|
||||
fi.setFile(mountPath.value(), System::getDCFileOnUsbStick(mountPath.value()));
|
||||
} else
|
||||
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
|
||||
fi.setFile(mountPath.value(), System::getDCFileOnSDCard(mountPath.value()));
|
||||
} else {
|
||||
|
||||
if (debug) {
|
||||
qInfo() << "using customer repository" << psaRepoDir;
|
||||
}
|
||||
|
||||
std::unique_ptr<QString> c = internal::dcCandidateToInstall("/etc/dc/");
|
||||
if (c) {
|
||||
fi.setFile(*c);
|
||||
if (fi.exists() == false) {
|
||||
qCritical() << "dc2c.bin candidate" << *c << "does not exist. STOP.";
|
||||
return -1;
|
||||
}
|
||||
qInfo() << "dc2c.bin canditate" << fi.absoluteFilePath();
|
||||
}
|
||||
// ------------------- single command line argument is DC-firmware binary file -----------------
|
||||
QStringList args = a.arguments();
|
||||
if (args.size() != 2) {
|
||||
qCritical() << "ERROR: missing parameter <dc-firmware>";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
qInfo() << "downloading dc-firmware" << fi.absoluteFilePath();
|
||||
qInfo() << "dc-firmware size (bytes)" << fi.size();
|
||||
qInfo() << "dc-version" << Update::dcVersion(fi.absoluteFilePath());
|
||||
qCritical() << "------------------------------------------------------";
|
||||
qCritical() << "main: argument dc-firmware: " << args.at(1);
|
||||
qCritical() << "------------------------------------------------------";
|
||||
|
||||
fi.setFile(args.at(1));
|
||||
|
||||
if (!fi.isFile()) {
|
||||
qCritical() << "ERROR: parameter " << fi.absoluteFilePath() << " is not a file";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!fi.isReadable()) {
|
||||
qCritical() << "ERROR: parameter " << fi.absoluteFilePath() << " is not readable";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
qCritical() << "------------------------------------------------------";
|
||||
qCritical() << "uploading dc-firmware" << fi.absoluteFilePath();
|
||||
qCritical() << "dc-firmware size (bytes)" << fi.size();
|
||||
qCritical() << "dc-version" << Update::dcVersion(fi.absoluteFilePath());
|
||||
qCritical() << "------------------------------------------------------";
|
||||
|
||||
Update u(fi.absoluteFilePath(), libca, debug, noaction);
|
||||
u.run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user