From 638f0eb3901a6cb35333d5bc495dc247d76f7603 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 18 Mar 2016 15:16:02 -0400 Subject: [PATCH] Fix a couple bugs in the sysadm/update check routine. Now it will report "rebootneeded" when the system is waiting to reboot to apply updates, and it allows for multiple "patch" entries now. --- src/server/library/sysadm-update.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/library/sysadm-update.cpp b/src/server/library/sysadm-update.cpp index 37cfe19..81e1510 100644 --- a/src/server/library/sysadm-update.cpp +++ b/src/server/library/sysadm-update.cpp @@ -17,10 +17,14 @@ using namespace sysadm; // Return a list of updates available QJsonObject Update::checkUpdates() { QJsonObject retObject; - + if(QFile::exists("/tmp/.rebootrequired")){ + retObject.insert("status","rebootrequired"); + return retObject; + } + QStringList output = General::RunCommand("pc-updatemanager check").split("\n"); QString nameval; - + int pnum=1; for ( int i = 0; i < output.size(); i++) { if ( output.at(i).indexOf("Your system is up to date!") != -1 ) @@ -56,7 +60,8 @@ QJsonObject Update::checkUpdates() { itemvals.insert("date", output.at(i+3).section(" ", 1, 1)); if ( output.size() > ( i + 4) ) itemvals.insert("size", output.at(i+4).section(" ", 1, 1)); - retObject.insert("patch", itemvals); + retObject.insert("patch"+QString::number(pnum), itemvals); + pnum++; } if ( output.at(i).indexOf("TYPE: PKGUPDATE") != -1 ) { QJsonObject itemvals;