From 31ea5f349710c78537181ee7c73768ab9f8119ea Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 2 Aug 2016 12:23:35 -0400 Subject: [PATCH] If there are no .conf files for the pkg repos yet, have it run "pkg update" to generate them and re-try the repo list function. --- src/server/library/sysadm-pkg.cpp | 6 +++++- src/server/library/sysadm-pkg.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/library/sysadm-pkg.cpp b/src/server/library/sysadm-pkg.cpp index c47118c..0f95886 100644 --- a/src/server/library/sysadm-pkg.cpp +++ b/src/server/library/sysadm-pkg.cpp @@ -327,10 +327,14 @@ QJsonArray PKG::list_categories(QString repo){ else{ return QJsonArray(); } } -QJsonArray PKG::list_repos(){ +QJsonArray PKG::list_repos(bool updated){ QString dbdir = "/var/db/pkg/repo-%1.sqlite"; QDir confdir("/usr/local/etc/pkg/repos"); QStringList confs = confdir.entryList(QStringList() << "*.conf", QDir::Files); + if(confs.isEmpty() && !updated){ + QProcess::execute("pkg update"); //need to update pkg configs + return list_repos(true); //try again recursively (will not try to update again) + } QStringList found; found << "local"; //There is always a local database (for installed pkgs) for(int i=0; i