mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 02:20:17 +00:00
Fix up sysadm to work with the corrupted/modified version of the pkg config files that sysup now auto-generates.
This commit is contained in:
@@ -379,13 +379,19 @@ QJsonArray PKG::list_repos(bool updated){
|
||||
QDir confdir(repodirs[d]);
|
||||
QStringList confs = confdir.entryList(QStringList() << "*.conf", QDir::Files);
|
||||
for(int i=0; i<confs.length(); i++){
|
||||
QStringList repoinfo = General::readTextFile(confdir.absoluteFilePath(confs[i])).join("\n").split("\n}");
|
||||
QStringList contents = General::readTextFile(confdir.absoluteFilePath(confs[i]));
|
||||
//Scan for any comments on the top of the file and remove them
|
||||
for(int l=0; l<contents.length(); l++){
|
||||
if(contents[l].isEmpty() || contents[l].startsWith("#")){ contents.removeAt(l); l--; }
|
||||
else{ break; }
|
||||
}
|
||||
QStringList repoinfo = contents.join("\n").split("\n}");
|
||||
for(int j=0; j<repoinfo.length(); j++){
|
||||
//qDebug() << "Repoinfo:" << repoinfo[j];
|
||||
qDebug() << "Repoinfo:" << repoinfo[j];
|
||||
QString repo = repoinfo[j].section(":",0,0).simplified();
|
||||
QString enabled = repoinfo[j].section("enabled:",1,-1).section(":",0,0).toLower();
|
||||
bool isEnabled = (enabled.contains("yes") || enabled.contains("true"));
|
||||
//qDebug() << "Checking Repo:" << repo << enabled << isEnabled;
|
||||
qDebug() << "Checking Repo:" << repo << enabled << isEnabled;
|
||||
if(QFile::exists(dbdir.arg(repo)) && isEnabled){ found << repo; }
|
||||
} //loop over repos listed in conf
|
||||
} //loop over confs in repodir
|
||||
|
||||
Reference in New Issue
Block a user