Commit e8923e97 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Only build with offline updats if it's available

parent e8d0f4b9
......@@ -14,6 +14,11 @@ add_library(packagekit-backend MODULE PackageKitBackend.cpp
LocalFilePKResource.cpp
TransactionSet.cpp
)
if(packagekitqt5_VERSION VERSION_GREATER 0.9.7)
target_compile_definitions(packagekit-backend -DHAS_OFFLINE_UPDATES)
endif()
target_link_libraries(packagekit-backend PRIVATE Discover::Common Qt5::Core PK::packagekitqt5 KF5::ConfigGui KF5::KIOCore KF5::Archive AppStreamQt)
install(TARGETS packagekit-backend DESTINATION ${PLUGIN_INSTALL_DIR}/discover)
......
......@@ -140,10 +140,12 @@ void PackageKitUpdater::processProceedFunction()
void PackageKitUpdater::proceed()
{
if (!m_proceedFunctions.isEmpty()) {
if (!m_proceedFunctions.isEmpty())
processProceedFunction();
} else if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
#ifdef HAS_OFFLINE_UPDATES
else if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
setupTransaction(PackageKit::Transaction::TransactionFlagOnlyTrusted | PackageKit::Transaction::TransactionFlagOnlyDownload);
#endif
else
setupTransaction(PackageKit::Transaction::TransactionFlagOnlyTrusted);
}
......@@ -181,7 +183,11 @@ void PackageKitUpdater::finished(PackageKit::Transaction::Exit exit, uint /*time
fetchLastUpdateTime();
if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
#ifdef HAS_OFFLINE_UPDATES
PackageKit::Daemon::global()->offlineTrigger(PackageKit::Daemon::ActionReboot);
#else
qWarning() << "PK_OFFLINE_UPDATE is set but discover was built against an old version of PackageKitQt that didn't support offline updates";
#endif
}
void PackageKitUpdater::cancellableChanged()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment