Ping.
Ping...
On 11/2/20 10:17 AM, kai wrote:
From: Kai Kang <kai.kang@windriver.com> Make systemctl prints help mesages if run without any argument. It helps to judge whether systemctl works in postscripts in systemd.bbclass. Remove trailing white spaces as well. Signed-off-by: Kai Kang <kai.kang@windriver.com> --- meta/recipes-core/systemd/systemd-systemctl/systemctl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 990de1ab39..c692b65920 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -30,7 +30,7 @@ class SystemdFile(): self._parse(root, path) dirname = os.path.basename(path.name) + ".d" for location in locations: - for path2 in sorted((root / location / "system" / dirname).glob("*.conf")): + for path2 in sorted((root / location / "system" / dirname).glob("*.conf")): self._parse(root, path2) def _parse(self, root, path): @@ -282,7 +282,7 @@ def main(): sys.exit("Python 3.4 or greater is required") parser = argparse.ArgumentParser() - parser.add_argument('command', nargs=1, choices=['enable', 'mask', + parser.add_argument('command', nargs='?', choices=['enable', 'mask', 'preset-all']) parser.add_argument('service', nargs=argparse.REMAINDER) parser.add_argument('--root') @@ -300,7 +300,11 @@ def main(): locations.append(BASE_LIBDIR / "systemd") locations.append(LIBDIR / "systemd") - command = args.command[0] + command = args.command + if not command: + parser.print_help() + return 0 + if command == "mask": for service in args.service: SystemdUnit(root, service).mask()