1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

kernel-install: clarify what is currently supported with --root and --image

`list` and `add-all` ignore `--root` or `--image`, working on the running
system instead.
Also improve the error message if `--image` is used.
This commit is contained in:
Antonio Alvarez Feijoo 2024-01-10 11:56:36 +01:00 committed by Luca Boccassi
parent 9540f8e216
commit 398760c84a

View File

@ -1182,7 +1182,7 @@ static int verb_add(int argc, char *argv[], void *userdata) {
assert(argv);
if (arg_root)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "'add' does not support --root=.");
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "'add' does not support --root= or --image=.");
if (bypass())
return 0;
@ -1221,6 +1221,9 @@ static int verb_add_all(int argc, char *argv[], void *userdata) {
assert(argv);
if (arg_root)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "'add-all' does not support --root= or --image=.");
if (bypass())
return 0;
@ -1309,7 +1312,7 @@ static int verb_remove(int argc, char *argv[], void *userdata) {
assert(argv);
if (arg_root)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "'remove' does not support --root=.");
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "'remove' does not support --root= or --image=.");
if (argc > 2)
log_debug("Too many arguments specified. 'kernel-install remove' takes only kernel version. "
@ -1450,6 +1453,9 @@ static int verb_list(int argc, char *argv[], void *userdata) {
_cleanup_close_ int fd = -EBADF;
int r;
if (arg_root)
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "'list' does not support --root= or --image=.");
fd = open("/usr/lib/modules", O_DIRECTORY|O_RDONLY|O_CLOEXEC);
if (fd < 0)
return log_error_errno(fd, "Failed to open /usr/lib/modules/: %m");