scripts: Port to the modern clr-boot-manager usage model

In the current system we depend on the legacy boot infrastructure, which
has been provided by clr-boot-manager in the way of compatibility scripts.
These scripts all do the same thing, which is to invoke clr-boot-manager
with the "update" subcommand.

Given that clr-boot-manager doesn't need to know the context of the
operation, i.e. it is able to deduce whether kernel or bootloaders need
updating, regardless, it makes little sense to use any of these scripts,
and we should begin to deprecate them.

In clr-boot-manager 2.0, we will look to remove these compat scripts
completely, however they will continue to exist until then to facilitate
necessary format bumps, etc.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2017-02-01 17:39:23 -08:00
committed by tmarcu
parent 504000ec3a
commit 6324401974
3 changed files with 12 additions and 42 deletions
+9 -35
View File
@@ -32,41 +32,19 @@
#include "swupd.h"
static void update_kernel(void)
static void update_boot(void)
{
char *kernel_update_cmd = NULL;
char *boot_update_cmd = NULL;
__attribute__((unused)) int ret = 0;
if (strcmp("/", path_prefix) == 0) {
string_or_die(&kernel_update_cmd, "/usr/bin/kernel_updater.sh");
string_or_die(&boot_update_cmd, "/usr/bin/clr-boot-manager update");
} else {
string_or_die(&kernel_update_cmd, "%s/usr/bin/kernel_updater.sh --path %s", path_prefix, path_prefix);
string_or_die(&boot_update_cmd, "%s/usr/bin/clr-boot-manager update --path %s", path_prefix, path_prefix);
}
system(kernel_update_cmd);
free(kernel_update_cmd);
}
static void update_bootloader(void)
{
char *bootloader_update_cmd = NULL;
if (strcmp("/", path_prefix) == 0) {
string_or_die(&bootloader_update_cmd, "/usr/bin/gummiboot_updaters.sh");
} else {
string_or_die(&bootloader_update_cmd, "%s/usr/bin/gummiboot_updaters.sh --path %s", path_prefix, path_prefix);
}
system(bootloader_update_cmd);
free(bootloader_update_cmd);
if (strcmp("/", path_prefix) == 0) {
string_or_die(&bootloader_update_cmd, "/usr/bin/systemdboot_updater.sh");
} else {
string_or_die(&bootloader_update_cmd, "%s/usr/bin/systemdboot_updater.sh --path %s", path_prefix, path_prefix);
}
system(bootloader_update_cmd);
free(bootloader_update_cmd);
ret = system(boot_update_cmd);
free(boot_update_cmd);
}
static void update_triggers(void)
@@ -80,12 +58,8 @@ void run_scripts(void)
printf("Calling post-update helper scripts.\n");
/* path_prefix aware helper */
if (need_update_boot) {
update_kernel();
}
if (need_update_bootloader) {
update_bootloader();
if (need_update_boot || need_update_bootloader) {
update_boot();
}
/* helpers which don't run when path_prefix is set */
+1 -1
View File
@@ -525,7 +525,7 @@ static void remove_orphaned_files(struct manifest *official_manifest)
/* Note: boot files marked as deleted should not be deleted by
* verify/fix; this task is delegated to an external program
* (currently /usr/bin/kernel_updater.sh).
* (currently /usr/bin/clr-boot-manager).
*/
if (ignore(file)) {
continue;
+2 -6
View File
@@ -9,10 +9,6 @@
^No kernel update needed, skipping helper call out.$
^No bootloader update needed, skipping helper call out.$
^Update took .* seconds$
^sh: .*/usr/bin/kernel_updater.sh: No such file or directory$
^sh: .*/usr/bin/gummiboot_updaters.sh: No such file or directory$
^sh: .*/usr/bin/systemdboot_updater.sh: No such file or directory$
^sh: .*/usr/bin/kernel_updater.sh: not found$
^sh: .*/usr/bin/gummiboot_updaters.sh: not found$
^sh: .*/usr/bin/systemdboot_updater.sh: not found$
^sh: .*/usr/bin/clr-boot-manager: No such file or directory$
^sh: .*/usr/bin/clr-boot-manager: not found$
^Possible filedescriptor leak: .*$