diff options
author | Kai Kang <kai.kang@windriver.com> | 2020-12-02 10:21:44 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-12-06 23:17:28 +0000 |
commit | 2ab32edca8ebf07be5c38954f8f860f5fa91c59d (patch) | |
tree | 311e4df9e0375c8a9ef9a3ebff6969344c7a2d2d | |
parent | 3ac2ba83f24783f5b0793a9faebd28fdca8dd3a4 (diff) | |
download | poky-2ab32edca8ebf07be5c38954f8f860f5fa91c59d.tar.gz |
systemd-systemctl-native: capable to call without argument
In systemd.bbclass, it will replace criterion command 'type systemctl'
with 'systemctl' without any argument to judge whether command systemctl
is available. The change is to fix install/remove package error in
container when command systemctl exists but not callable.
Make native systemctl wrapper prints help mesages if called without any
argument to follow the update.
(From OE-Core rev: 811ebb4adc5cfcc24ac4460fe89fe68d8d03d837)
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | meta/recipes-core/systemd/systemd-systemctl/systemctl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 990de1ab39..de733e255b 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl | |||
@@ -282,7 +282,7 @@ def main(): | |||
282 | sys.exit("Python 3.4 or greater is required") | 282 | sys.exit("Python 3.4 or greater is required") |
283 | 283 | ||
284 | parser = argparse.ArgumentParser() | 284 | parser = argparse.ArgumentParser() |
285 | parser.add_argument('command', nargs=1, choices=['enable', 'mask', | 285 | parser.add_argument('command', nargs='?', choices=['enable', 'mask', |
286 | 'preset-all']) | 286 | 'preset-all']) |
287 | parser.add_argument('service', nargs=argparse.REMAINDER) | 287 | parser.add_argument('service', nargs=argparse.REMAINDER) |
288 | parser.add_argument('--root') | 288 | parser.add_argument('--root') |
@@ -300,7 +300,11 @@ def main(): | |||
300 | locations.append(BASE_LIBDIR / "systemd") | 300 | locations.append(BASE_LIBDIR / "systemd") |
301 | locations.append(LIBDIR / "systemd") | 301 | locations.append(LIBDIR / "systemd") |
302 | 302 | ||
303 | command = args.command[0] | 303 | command = args.command |
304 | if not command: | ||
305 | parser.print_help() | ||
306 | return 0 | ||
307 | |||
304 | if command == "mask": | 308 | if command == "mask": |
305 | for service in args.service: | 309 | for service in args.service: |
306 | SystemdUnit(root, service).mask() | 310 | SystemdUnit(root, service).mask() |