make sure dcDir can be overwritten on commandline. however, not if usb/sd was detected.
This commit is contained in:
@@ -134,10 +134,13 @@ 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 psaDcDir = internal::customerRepoDcDir();
|
||||||
QString const &psaRepoRootDir = internal::customerRepoRoot();
|
QString psaRepoRootDir = internal::customerRepoRoot();
|
||||||
QString const &psaRepoDir = internal::customerRepoDir();
|
QString psaRepoDir = internal::customerRepoDir();
|
||||||
QString const &branchName = internal::branchName();
|
QString branchName = internal::branchName();
|
||||||
|
QString rootDir = "/etc/dc/";
|
||||||
|
// bool usbDetected = false;
|
||||||
|
// bool sdCardDetected = false;
|
||||||
|
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
bool noaction = true;
|
bool noaction = true;
|
||||||
@@ -151,8 +154,17 @@ int main(int argc, char **argv) {
|
|||||||
workingDir = settings->value("workingdir", "/tmp").toString();
|
workingDir = settings->value("workingdir", "/tmp").toString();
|
||||||
libca = settings->value("libca", "/usr/lib/libCAslave.so").toString();
|
libca = settings->value("libca", "/usr/lib/libCAslave.so").toString();
|
||||||
settings->endGroup();
|
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) {
|
if (debug) {
|
||||||
qInfo() << " using dc directory: " << psaDcDir;
|
qInfo() << " using dc directory: " << psaDcDir;
|
||||||
qInfo() << "using psa repo root directory: " << psaRepoRootDir;
|
qInfo() << "using psa repo root directory: " << psaRepoRootDir;
|
||||||
@@ -164,26 +176,33 @@ int main(int argc, char **argv) {
|
|||||||
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()) {
|
||||||
|
// usbDetected = true;
|
||||||
|
// mountPath/etc/dc must exists !
|
||||||
|
// cannot override with commandline parameter --dc-directory
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qInfo() << "using mount path (USB): " << mountPath.value();
|
qInfo() << "using mount path (USB): " << mountPath.value();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
|
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
|
||||||
|
// sdCardDetected = true;
|
||||||
|
// mountPath/etc/dc must exists !
|
||||||
|
// cannot override with commandline parameter --dc-directory
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qInfo() << "using mount path (SD): " << mountPath.value();
|
qInfo() << "using mount path (SD): " << mountPath.value();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
rootDir = "";
|
||||||
|
mountPath = QDir::cleanPath(psaRepoRootDir + QDir::separator() + psaDcDir);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
qInfo() << "using customer repository" << psaRepoDir;
|
qInfo() << "using as dc-directory" << mountPath.value();
|
||||||
}
|
}
|
||||||
mountPath = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
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) {
|
if (c) {
|
||||||
fi.setFile(*c);
|
fi.setFile(*c);
|
||||||
if (fi.exists() == false) {
|
if (fi.exists() == false) {
|
||||||
|
Reference in New Issue
Block a user