clean up: remove .gz and .ipk files in /var/cache/opkg

This commit is contained in:
Gerhard Hoffmann 2024-10-08 15:03:43 +02:00
parent 0d00faf493
commit 8f6e1fdae7
2 changed files with 18 additions and 0 deletions

View File

@ -864,7 +864,24 @@ bool Worker::computeFilesToDownload() {
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() {
if (!cleanUpOpkgCache()) {
CONSOLE() << "INFO: some cached opkg files not removed";
}
for (int i = 0; i < m_filesToUpdate.size(); ++i) {
QString const fName = m_filesToUpdate.at(i);
if (fName.contains("opkg_commands", Qt::CaseInsensitive)) {

View File

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