From: Michael Tremer Date: Sun, 30 Jun 2019 11:16:51 +0000 (+0100) Subject: libpakfire: Run ldconfig after erasing/extracting files X-Git-Tag: 0.9.28~1285^2~928 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52b6b95b2d571bafef7cce0a67be457d7138810c;p=pakfire.git libpakfire: Run ldconfig after erasing/extracting files Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/step.c b/src/libpakfire/step.c index f279cd44c..c658df54c 100644 --- a/src/libpakfire/step.c +++ b/src/libpakfire/step.c @@ -412,6 +412,24 @@ static int pakfire_step_run_script(PakfireStep step, pakfire_script_type script) return 0; } +static int pakfire_run_ldconfig(PakfireStep step) { + const char* ldconfig = "/usr/sbin/ldconfig"; + + int r = -1; + + // XXX check if package has some files that require to run ldconfig + + const char* path = pakfire_get_path(step->pakfire); + + if (pakfire_access(step->pakfire, path, ldconfig + 1, X_OK) == 0) { + r = pakfire_execute(step->pakfire, ldconfig, NULL, 0); + + DEBUG(step->pakfire, "ldconfig returned %d\n", r); + } + + return r; +} + static int pakfire_step_extract(PakfireStep step) { if (!step->archive) { ERROR(step->pakfire, "Archive was not opened\n"); @@ -426,10 +444,16 @@ static int pakfire_step_extract(PakfireStep step) { pakfire_free(nevra); } + // Update the runtime linker cache + pakfire_run_ldconfig(step); + return r; } static int pakfire_step_erase(PakfireStep step) { + // Update the runtime linker cache after all files have been removed + pakfire_run_ldconfig(step); + return 0; // TODO }