#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <syslog.h>
#include <unistd.h>
}
}
+static void pakfire_lock_running_kernel(Pakfire pakfire, Pool* pool) {
+ struct utsname utsname;
+ char buffer[NAME_MAX];
+
+ // Nothing to do when not running on /
+ if (!pakfire_on_root(pakfire))
+ return;
+
+ // Call uname()
+ int r = uname(&utsname);
+ if (r) {
+ ERROR(pakfire, "uname() failed: %m\n");
+ return;
+ }
+
+ DEBUG(pakfire, "Locking running kernel %s\n", utsname.release);
+
+ r = pakfire_string_format(buffer, "kernel(%s)", utsname.release);
+ if (r < 0)
+ return;
+
+ // Add a locking pool job
+ Id id = pool_str2id(pool, buffer, 1);
+ if (id)
+ queue_push2(&pool->pooljobs, SOLVER_LOCK|SOLVER_SOLVABLE_PROVIDES, id);
+}
+
static int pakfire_populate_pool(Pakfire pakfire) {
struct pakfire_db* db;
PakfireRepo repo = NULL;
// Add multiinstall packages
pakfire_pool_add_multiinstall(pool);
+ // Lock the running kernel
+ pakfire_lock_running_kernel(pakfire, pool);
+
// Open database in read-only mode and try to load all installed packages
r = pakfire_db_open(&db, pakfire, PAKFIRE_DB_READWRITE);
if (r)