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;
|
||||
}
|
||||
|
||||
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
|
||||
QString const &customerRepo = QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
|
||||
QStringList filesToUpdate;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
// etc/psa_config: located under mount-path
|
||||
std::optional<QString> mountPath = System::checkForUSBStick(psaConfigDir);
|
||||
if (mountPath.has_value()) {
|
||||
filesToUpdate = System::getJsonFilesOnUsbStick(mountPath.value());
|
||||
} else {
|
||||
qCritical() << "DIRECTORY" << dir << "DOES NOT EXIST";
|
||||
return -1;
|
||||
qCritical() << "Using customer repository" << customerRepo;
|
||||
|
||||
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,
|
||||
QString::number(customerNr),
|
||||
@ -143,10 +146,13 @@ int main(int argc, char **argv) {
|
||||
plugInName,
|
||||
workingDir);
|
||||
|
||||
//update.checkJsonVersions();
|
||||
update.doUpdate(filesToUpdate);
|
||||
update.checkJsonVersions(filesToUpdate);
|
||||
update.doUpdate(filesToUpdate, mountPath.has_value());
|
||||
update.checkJsonVersions();
|
||||
//update.checkJsonVersions(filesToUpdate);
|
||||
|
||||
if (mountPath.has_value()) {
|
||||
System::umountUSBStick();
|
||||
}
|
||||
|
||||
//return a.exec();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user