From: "kai" <kai.kang@windriver.com>
To: obi@opendreambox.org
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH 1/2] systemd-systemctl: capable to call without argument
Date: Tue, 17 Nov 2020 10:14:41 +0800 [thread overview]
Message-ID: <aec8898c-4fca-9336-d947-54db4d08bad3@windriver.com> (raw)
In-Reply-To: <16438F587D21D644.10137@lists.openembedded.org>
[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]
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()
>
>
>
[-- Attachment #2: Type: text/html, Size: 2833 bytes --]
next prev parent reply other threads:[~2020-11-17 2:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 2:17 [PATCH 0/2] Update check for systemctl kai
2020-11-02 2:17 ` [PATCH 1/2] systemd-systemctl: capable to call without argument kai
2020-11-02 2:17 ` [PATCH 2/2] systemd.bbclass: check whether systemctl works in post scripts kai
[not found] ` <16438F587D21D644.10137@lists.openembedded.org>
2020-11-17 2:14 ` kai [this message]
2020-11-23 10:59 ` [OE-core] [PATCH 1/2] systemd-systemctl: capable to call without argument kai
2020-11-20 2:03 ` kai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aec8898c-4fca-9336-d947-54db4d08bad3@windriver.com \
--to=kai.kang@windriver.com \
--cc=obi@opendreambox.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox