make sure dcDir can be overwritten on commandline. however, not if usb/sd was detected.

This commit is contained in:
2025-10-02 15:31:36 +02:00
parent 67eeade609
commit 0bca22f995

View File

@@ -134,10 +134,13 @@ int main(int argc, char **argv) {
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();
QString psaDcDir = internal::customerRepoDcDir();
QString psaRepoRootDir = internal::customerRepoRoot();
QString psaRepoDir = internal::customerRepoDir();
QString branchName = internal::branchName();
QString rootDir = "/etc/dc/";
// bool usbDetected = false;
// bool sdCardDetected = false;
bool debug = false;
bool noaction = true;
@@ -151,8 +154,17 @@ int main(int argc, char **argv) {
workingDir = settings->value("workingdir", "/tmp").toString();
libca = settings->value("libca", "/usr/lib/libCAslave.so").toString();
settings->endGroup();
} else {
qCritical() << "count not read ATBUpdateTool.ini";
return -1;
}
QString dcDir = parser.dcDir();
if (!dcDir.isEmpty()) {
psaDcDir = dcDir;
}
debug = parser.debug();
if (debug) {
qInfo() << " using dc directory: " << psaDcDir;
qInfo() << "using psa repo root directory: " << psaRepoRootDir;
@@ -164,26 +176,33 @@ int main(int argc, char **argv) {
std::optional<QString> mountPath = System::checkForUSBStick(psaDcDir);
QFileInfo fi;
if (mountPath.has_value()) {
// usbDetected = true;
// mountPath/etc/dc must exists !
// cannot override with commandline parameter --dc-directory
if (debug) {
qInfo() << "using mount path (USB): " << mountPath.value();
}
} else
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
// sdCardDetected = true;
// mountPath/etc/dc must exists !
// cannot override with commandline parameter --dc-directory
if (debug) {
qInfo() << "using mount path (SD): " << mountPath.value();
}
} else {
rootDir = "";
mountPath = QDir::cleanPath(psaRepoRootDir + QDir::separator() + psaDcDir);
if (debug) {
qInfo() << "using customer repository" << psaRepoDir;
qInfo() << "using as dc-directory" << mountPath.value();
}
mountPath = "";
}
if (debug) {
qInfo() << "using mount path: " << mountPath.value();
qInfo() << "using as mount path: " << mountPath.value();
}
std::unique_ptr<QString> c = internal::dcCandidateToInstall("/etc/dc/", mountPath.value());
std::unique_ptr<QString> c = internal::dcCandidateToInstall(rootDir, mountPath.value());
if (c) {
fi.setFile(*c);
if (fi.exists() == false) {