From 5aacba78408a2b672a5ec3f31ad5bb09a837d2c6 Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Thu, 27 Feb 2020 14:30:15 -0800 Subject: [PATCH] scripts: Always run ld_config before running any update scripts It's possible to create a post_update script to run ld_config, but we had problems with this in the past, so it was decided to hardcode that on swupd instead of relying on scripts. Signed-off-by: Otavio Pontes --- src/scripts.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/scripts.c b/src/scripts.c index 52954b621..0f62961c1 100644 --- a/src/scripts.c +++ b/src/scripts.c @@ -94,6 +94,21 @@ static void exec_post_update_script(bool reexec, bool block) free(params[0]); } +static void run_ld_config() +{ + int err; + + if (strcmp("/", globals.path_prefix) == 0) { + err = run_command_quiet("/usr/bin/ldconfig", NULL); + } else { + err = run_command_quiet("/bin/chroot", globals.path_prefix, "/usr/bin/ldconfig", NULL); + } + + if (err) { + debug("Running ldconfig failed with error code = %d", err); + } +} + static void update_triggers(bool block) { if (strlen(POST_UPDATE) == 0) { @@ -152,6 +167,7 @@ void scripts_run_post_update(bool block) } } + run_ld_config(); update_triggers(block); }