mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
kernel-install: make inspect command optionally take kernel image
If the kernel image is provided, then we can inspect the kernel image and may determine the layout based on the kernel image type.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
<command>kernel-install</command>
|
||||
<arg choice="opt" rep="repeat">OPTIONS</arg>
|
||||
<arg choice="plain">inspect</arg>
|
||||
<arg choice="opt"><replaceable>KERNEL-IMAGE</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -158,7 +159,7 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><command>inspect</command></term>
|
||||
<term><command>inspect [<replaceable>KERNEL-IMAGE</replaceable>]</command></term>
|
||||
<listitem>
|
||||
<para>Shows the various paths and parameters configured or auto-detected. In particular shows the
|
||||
values of the various <varname>$KERNEL_INSTALL_*</varname> environment variables listed
|
||||
|
||||
@@ -866,7 +866,7 @@ static int context_build_arguments(Context *c) {
|
||||
return log_oom();
|
||||
|
||||
} else if (c->action == ACTION_INSPECT) {
|
||||
r = strv_extend(&a, "[KERNEL_IMAGE]");
|
||||
r = strv_extend(&a, c->kernel ?: "[KERNEL_IMAGE]");
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
@@ -1043,6 +1043,12 @@ static int verb_inspect(int argc, char *argv[], void *userdata) {
|
||||
|
||||
c->action = ACTION_INSPECT;
|
||||
|
||||
if (argc >= 2) {
|
||||
r = context_set_kernel(c, argv[1]);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = context_prepare_execution(c);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -1093,7 +1099,7 @@ static int help(void) {
|
||||
"\nUsage:\n"
|
||||
" %1$s [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...]\n"
|
||||
" %1$s [OPTIONS...] remove KERNEL-VERSION\n"
|
||||
" %1$s [OPTIONS...] inspect\n"
|
||||
" %1$s [OPTIONS...] inspect [KERNEL-IMAGE]\n"
|
||||
"\nOptions:\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Show package version\n"
|
||||
@@ -1149,7 +1155,7 @@ static int run(int argc, char* argv[]) {
|
||||
static const Verb verbs[] = {
|
||||
{ "add", 3, VERB_ANY, 0, verb_add },
|
||||
{ "remove", 2, 2, 0, verb_remove },
|
||||
{ "inspect", 1, 1, VERB_DEFAULT, verb_inspect },
|
||||
{ "inspect", 1, 2, VERB_DEFAULT, verb_inspect },
|
||||
{}
|
||||
};
|
||||
_cleanup_(context_done) Context c = {
|
||||
|
||||
@@ -63,6 +63,7 @@ grep -qE 'image' "$BOOT_ROOT/the-token/1.1.1/linux"
|
||||
grep -qE 'initrd' "$BOOT_ROOT/the-token/1.1.1/initrd"
|
||||
|
||||
"$kernel_install" inspect
|
||||
"$kernel_install" inspect "$D/sources/linux"
|
||||
|
||||
"$kernel_install" -v remove 1.1.1
|
||||
test ! -e "$entry"
|
||||
|
||||
Reference in New Issue
Block a user