kernel-install: Fix inspect with --root= when no version is specified
Using the kernel version from the host is incorrect in this case, so fix the logic so it handles no version being specified correctly with --root=.
This commit is contained in:
committed by
Luca Boccassi
parent
9fb2a61830
commit
dbab005645
@@ -306,7 +306,7 @@ static int context_set_uki_generator(Context *c, const char *s, const char *sour
|
||||
static int context_set_version(Context *c, const char *s) {
|
||||
assert(c);
|
||||
|
||||
if (!filename_is_valid(s))
|
||||
if (s && !filename_is_valid(s))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid version specified: %s", s);
|
||||
|
||||
return context_set_string(s, "command line", "kernel version", &c->version);
|
||||
@@ -1355,12 +1355,12 @@ static int verb_inspect(int argc, char *argv[], void *userdata) {
|
||||
(argc > 1 ? empty_or_dash_to_null(argv[1]) : NULL);
|
||||
initrds = strv_skip(argv, 3);
|
||||
|
||||
if (!version) {
|
||||
if (!version && !arg_root) {
|
||||
assert_se(uname(&un) >= 0);
|
||||
version = un.release;
|
||||
}
|
||||
|
||||
if (!kernel) {
|
||||
if (!kernel && version) {
|
||||
r = kernel_from_version(version, &vmlinuz);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user