diff --git a/src/server/EventWatcher.cpp b/src/server/EventWatcher.cpp index d26562e..8b54458 100644 --- a/src/server/EventWatcher.cpp +++ b/src/server/EventWatcher.cpp @@ -371,6 +371,18 @@ void EventWatcher::CheckSystemState(){ if(updates.value("status").toString()!="noupdates"){ int tmp = 2; if(updates.value("status").toString()=="rebootrequired"){ tmp = 9; } //user input required + else if(updates.value("status").toString()!="updaterunning"){ + //updates are available - see if the auto-update flag is set, and start the updates as needed + QJsonObject upset = sysadm::Update::readSettings(); + QDateTime last = sysadm::Update::lastFullCheck().addSecs(60); //wait one interval before starting auto-updates (15 min intervals usually) + if( (!upset.contains("auto_update") || updates.value("auto_update").toString().toLower()!="all") && (QDateTime::currentDateTime() > last) ){ + QJsonObject obj; + obj.insert("target", "pkgupdate"); //since everything is run with pkg now + sysadm::Update::startUpdate(obj); + QCoreApplication::processEvents(); //make sure everything gets started + updates = sysadm::Update::checkUpdates(true); //will be almost instant - updates should already be running now + } + } if(priority