]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind,importd,hostnamed,localed,timedated,machined,resolved: add option parsing...
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 23 Apr 2020 08:19:46 +0000 (10:19 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 3 May 2020 08:55:51 +0000 (10:55 +0200)
--help and --version are implemented in the usual style.
help() prints full path, since the program is not expected to
be in $PATH.

src/hostname/hostnamed.c
src/import/importd.c
src/locale/localed.c
src/login/logind.c
src/machine/machined.c
src/resolve/resolved.c
src/timedate/timedated.c

index ad6577c37e630894b9b290c185334b3491e04e10..b2b5299b32535396960371c25b771ad02c3222a9 100644 (file)
@@ -26,6 +26,7 @@
 #include "parse-util.h"
 #include "path-util.h"
 #include "selinux-util.h"
+#include "service-util.h"
 #include "signal-util.h"
 #include "strv.h"
 #include "user-util.h"
@@ -780,14 +781,15 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
+        r = service_parse_argv("systemd-hostnamed.service",
+                               "Manage the system hostname and related metadata.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
+
         umask(0022);
         mac_selinux_init();
 
-        if (argc != 1) {
-                log_error("This program takes no arguments.");
-                return -EINVAL;
-        }
-
         assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
 
         r = sd_event_default(&event);
index 2e5c1c26420edd49331420e9b264c4668b085e9d..ea16c9bec4171e1216e1689d4dd70e0ab4f89635 100644 (file)
@@ -22,6 +22,7 @@
 #include "path-util.h"
 #include "process-util.h"
 #include "signal-util.h"
+#include "service-util.h"
 #include "socket-util.h"
 #include "stat-util.h"
 #include "string-table.h"
@@ -1374,12 +1375,13 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
-        umask(0022);
+        r = service_parse_argv("systemd-importd.service",
+                               "VM and container image import and export service.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
 
-        if (argc != 1) {
-                log_error("This program takes no arguments.");
-                return -EINVAL;
-        }
+        umask(0022);
 
         assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, -1) >= 0);
 
index 7315d93a9822c19c6bad0ee7eb9bc3bfc827322f..a0fcadcc9148ece3a31484cd57f6b52f5da4d48e 100644 (file)
@@ -25,6 +25,7 @@
 #include "missing_capability.h"
 #include "path-util.h"
 #include "selinux-util.h"
+#include "service-util.h"
 #include "signal-util.h"
 #include "string-util.h"
 #include "strv.h"
@@ -754,12 +755,15 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
+        r = service_parse_argv("systemd-localed.service",
+                               "Manage system locale settings and key mappings.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
+
         umask(0022);
         mac_selinux_init();
 
-        if (argc != 1)
-                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
-
         assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
 
         r = sd_event_default(&event);
index 75958189ac803451ff207e6cdfa6474b8387c876..4678b22bea1c81713206a68c45d2ecb840a113bc 100644 (file)
@@ -27,6 +27,7 @@
 #include "parse-util.h"
 #include "process-util.h"
 #include "selinux-util.h"
+#include "service-util.h"
 #include "signal-util.h"
 #include "strv.h"
 #include "terminal-util.h"
@@ -1201,12 +1202,13 @@ static int run(int argc, char *argv[]) {
         log_set_facility(LOG_AUTH);
         log_setup_service();
 
-        umask(0022);
+        r = service_parse_argv("systemd-logind.service",
+                               "Manager for user logins and devices and privileged operations.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
 
-        if (argc != 1) {
-                log_error("This program takes no arguments.");
-                return -EINVAL;
-        }
+        umask(0022);
 
         r = mac_selinux_init();
         if (r < 0)
index a93bfc42be2560698730cb1364bbf20b213313e1..191031e2aabeb5a49429cfa26a669de673e687ca 100644 (file)
@@ -22,6 +22,7 @@
 #include "machined.h"
 #include "main-func.h"
 #include "process-util.h"
+#include "service-util.h"
 #include "signal-util.h"
 #include "special.h"
 
@@ -357,12 +358,13 @@ static int run(int argc, char *argv[]) {
         log_set_facility(LOG_AUTH);
         log_setup_service();
 
-        umask(0022);
+        r = service_parse_argv("systemd-machined.service",
+                               "Manage registrations of local VMs and containers.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
 
-        if (argc != 1) {
-                log_error("This program takes no arguments.");
-                return -EINVAL;
-        }
+        umask(0022);
 
         /* Always create the directories people can create inotify watches in. Note that some applications might check
          * for the existence of /run/systemd/machines/ to determine whether machined is available, so please always
index 27848cccae7bc3e854489301a92cdd3c069e79e3..73da508d7ac6ce9682b679de0119c67c482671c4 100644 (file)
@@ -15,6 +15,7 @@
 #include "resolved-manager.h"
 #include "resolved-resolv-conf.h"
 #include "selinux-util.h"
+#include "service-util.h"
 #include "signal-util.h"
 #include "user-util.h"
 
@@ -25,8 +26,11 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
-        if (argc != 1)
-                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
+        r = service_parse_argv("systemd-resolved.service",
+                               "Provide name resolution with caching using DNS, mDNS, LLMNR.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
 
         umask(0022);
 
index 8e15cd4f06e35e319746a700e073e6e5bf7b03fe..6dac0bafffa11ae8b5e63f67165a25c0de0499ba 100644 (file)
@@ -28,6 +28,7 @@
 #include "missing_capability.h"
 #include "path-util.h"
 #include "selinux-util.h"
+#include "service-util.h"
 #include "signal-util.h"
 #include "string-util.h"
 #include "strv.h"
@@ -1126,10 +1127,13 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
-        umask(0022);
+        r = service_parse_argv("systemd-timedated.service",
+                               "Manage the system clock and timezone and NTP enablement.",
+                               argc, argv);
+        if (r <= 0)
+                return r;
 
-        if (argc != 1)
-                return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
+        umask(0022);
 
         assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);