From: Antonio Alvarez Feijoo Date: Wed, 10 Jan 2024 10:56:36 +0000 (+0100) Subject: kernel-install: clarify what is currently supported with --root and --image X-Git-Tag: v256-rc1~1214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=398760c84a4995a0e699b9c991a2ba9e65dd1bdc;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/kernel-install/kernel-install.c b/src/kernel-install/kernel-install.c index 1cf0fa28f45..d33a3ddf2f3 100644 --- a/src/kernel-install/kernel-install.c +++ b/src/kernel-install/kernel-install.c @@ -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");