Compare commits

..

6 Commits

5 changed files with 40 additions and 15 deletions

View File

@@ -138,7 +138,9 @@ DEFINES += QT_DEPRECATED_WARNINGS
# 1.5.0 : Use ptu-config.atb-comm.de (given in ini-file) as new server for # 1.5.0 : Use ptu-config.atb-comm.de (given in ini-file) as new server for
# customer repositories. # customer repositories.
# Fix: allow empty lines in opkg_commands. # Fix: allow empty lines in opkg_commands.
VERSION="1.5.0" # 1.5.1 : Fix: do not use cleanPath() on a url-address.
# 1.5.2 : Remove .ipk and .gz files in /var/cache/opkg.
VERSION="1.5.2"
# PLANNED TODOS: # PLANNED TODOS:
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT. # 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu # 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu

View File

@@ -74,6 +74,11 @@ int main(int argc, char *argv[]) {
parser.readSettings(); parser.readSettings();
QString repositoryUrl = parser.repositoryUrl(); QString repositoryUrl = parser.repositoryUrl();
if (repositoryUrl.endsWith('/')) {
repositoryUrl.chop(1);
}
QString gitSSHCommand(""); QString gitSSHCommand("");
if (repositoryUrl.contains("ptu-config.atb-comm.de")) { if (repositoryUrl.contains("ptu-config.atb-comm.de")) {

View File

@@ -110,19 +110,19 @@ QString Utils::getTariffInfo(QString fileName) {
} }
QString Utils::zoneName(quint8 i) { QString Utils::zoneName(quint8 i) {
static constexpr char const *zName[] = { //static constexpr char const *zName[] = {
"", // "",
"purple", // "purple",
"blue", // "blue",
"yellow", // "yellow",
"green", // "green",
"yellow (mars)", // "yellow (mars)",
"green (mars)" // "green (mars)"
}; //};
if (i < (sizeof(zName)/sizeof(char const *))) { //if (i < (sizeof(zName)/sizeof(char const *))) {
return zName[i]; // return zName[i];
} //}
return "N/A"; return "---";
} }
void Utils::printCriticalErrorMsg(QString const &errorMsg, bool upper, bool lower) { void Utils::printCriticalErrorMsg(QString const &errorMsg, bool upper, bool lower) {

View File

@@ -148,7 +148,7 @@ Worker::Worker(int customerNr,
, m_pluginName(pluginName) , m_pluginName(pluginName)
, m_workingDirectory(workingDirectory) , m_workingDirectory(workingDirectory)
, m_branchName(branchName) , m_branchName(branchName)
, m_customerRepositoryPath(QDir::cleanPath(QString("%1/%2.git").arg(repositoryUrl).arg(m_customerNrStr))) , m_customerRepositoryPath(QString("%1/%2.git").arg(repositoryUrl).arg(m_customerNrStr))
, m_customerRepository(QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr)) , m_customerRepository(QDir::cleanPath(m_workingDirectory + QDir::separator() + m_customerNrStr))
, m_noUpdatePsaHardware(noUpdatePsaHardware) , m_noUpdatePsaHardware(noUpdatePsaHardware)
, m_alwaysDownloadConfig(alwaysDownloadConfig) , m_alwaysDownloadConfig(alwaysDownloadConfig)
@@ -864,7 +864,24 @@ bool Worker::computeFilesToDownload() {
return (m_filesToDownload.size() > 0); return (m_filesToDownload.size() > 0);
} }
bool Worker::cleanUpOpkgCache() {
bool removedFiles = true;
QDir dir("/var/cache/opkg");
if (dir.exists()) {
dir.setNameFilters(QStringList() << ".gz" << ".ipk");
dir.setFilter(QDir::Files);
foreach(QString dirFile, dir.entryList()) {
removedFiles &= dir.remove(dirFile);
}
}
return removedFiles;
}
bool Worker::execOpkgCommands() { bool Worker::execOpkgCommands() {
if (!cleanUpOpkgCache()) {
CONSOLE() << "INFO: some cached opkg files not removed";
}
for (int i = 0; i < m_filesToUpdate.size(); ++i) { for (int i = 0; i < m_filesToUpdate.size(); ++i) {
QString const fName = m_filesToUpdate.at(i); QString const fName = m_filesToUpdate.at(i);
if (fName.contains("opkg_commands", Qt::CaseInsensitive)) { if (fName.contains("opkg_commands", Qt::CaseInsensitive)) {

View File

@@ -193,6 +193,7 @@ class Worker : public QThread{
QString m_apismVersion; QString m_apismVersion;
bool executeOpkgCommand(QString opkgCommand); bool executeOpkgCommand(QString opkgCommand);
bool cleanUpOpkgCache();
QString getOsVersion() const; QString getOsVersion() const;
QString getATBQTVersion() const; QString getATBQTVersion() const;
QString getATBUpdateToolVersion() const; QString getATBUpdateToolVersion() const;