Skip to content

Commit

Permalink
scripts: Always run ld_config before running any update scripts
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Otavio Pontes committed Feb 27, 2020
1 parent ca0b6b9 commit 5aacba7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/scripts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -152,6 +167,7 @@ void scripts_run_post_update(bool block)
}
}

run_ld_config();
update_triggers(block);
}

Expand Down

0 comments on commit 5aacba7

Please sign in to comment.