Update (conf) JSON-Files using USB stick. When plugged in, look for
JSON-files in directory psa-config-directory and load them to the PSA. Note: these files are overwritten during a usual ISMAS-update if not checked in into the customer repository.
This commit is contained in:
parent
b24c50c572
commit
c0d014644c
@ -113,28 +113,31 @@ int main(int argc, char **argv) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString const customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
||||||
|
|
||||||
qCritical() << "Using customer repository" << customerRepo;
|
|
||||||
|
|
||||||
// always execute contents of opkg_commands-file
|
|
||||||
QStringList filesToUpdate;
|
QStringList filesToUpdate;
|
||||||
|
|
||||||
QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config"));
|
// etc/psa_config: located under mount-path
|
||||||
|
std::optional<QString> mountPath = System::checkForUSBStick(psaConfigDir);
|
||||||
if (dir.exists()) {
|
if (mountPath.has_value()) {
|
||||||
QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files);
|
filesToUpdate = System::getJsonFilesOnUsbStick(mountPath.value());
|
||||||
if (!jsons.isEmpty()) {
|
|
||||||
for (QStringList::size_type i=0; i<jsons.size(); ++i) {
|
|
||||||
filesToUpdate << QDir::cleanPath(QString("etc/psa_config/") + jsons.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "DIRECTORY" << dir << "DOES NOT EXIST";
|
qCritical() << "Using customer repository" << customerRepo;
|
||||||
return -1;
|
|
||||||
|
QDir dir(QDir::cleanPath(customerRepo + QDir::separator() + "etc/psa_config"));
|
||||||
|
if (dir.exists()) {
|
||||||
|
QStringList jsons = dir.entryList(QStringList() << "DC2C*.json", QDir::Files);
|
||||||
|
if (!jsons.isEmpty()) {
|
||||||
|
for (QStringList::size_type i=0; i<jsons.size(); ++i) {
|
||||||
|
filesToUpdate << QDir::cleanPath(QString("etc/psa_config/") + jsons.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCritical() << "DIRECTORY" << dir << "DOES NOT EXIST";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "JSON FILES TO UPDATE" << filesToUpdate;
|
// qCritical() << "JSON FILES TO UPDATE" << filesToUpdate;
|
||||||
|
|
||||||
Update update(customerRepo,
|
Update update(customerRepo,
|
||||||
QString::number(customerNr),
|
QString::number(customerNr),
|
||||||
@ -143,10 +146,13 @@ int main(int argc, char **argv) {
|
|||||||
plugInName,
|
plugInName,
|
||||||
workingDir);
|
workingDir);
|
||||||
|
|
||||||
//update.checkJsonVersions();
|
update.doUpdate(filesToUpdate, mountPath.has_value());
|
||||||
update.doUpdate(filesToUpdate);
|
update.checkJsonVersions();
|
||||||
update.checkJsonVersions(filesToUpdate);
|
//update.checkJsonVersions(filesToUpdate);
|
||||||
|
|
||||||
|
if (mountPath.has_value()) {
|
||||||
|
System::umountUSBStick();
|
||||||
|
}
|
||||||
|
|
||||||
//return a.exec();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user