summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2020-12-02 10:21:44 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-06 23:16:50 +0000
commit811ebb4adc5cfcc24ac4460fe89fe68d8d03d837 (patch)
tree922effc04ab68013ba227053da56aa2f90cee266
parent88d05be28da522fb390ee24f2871a113adf4366e (diff)
downloadopenembedded-core-contrib-811ebb4adc5cfcc24ac4460fe89fe68d8d03d837.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. Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl8
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():
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()